Re: [RFC PATCH v2 2/6] fuse: move fuse_entry_out structs out of the stack

From: Bernd Schubert

Date: Mon Dec 15 2025 - 09:04:03 EST


On 12/12/25 19:12, Luis Henriques wrote:
> This patch simply turns all struct fuse_entry_out instances that are
> allocated in the stack into dynamically allocated structs. This is a
> preparation patch for further changes, including the extra helper function
> used to actually allocate the memory.
>
> Also, remove all the memset()s that are used to zero-out these structures,
> as kzalloc() is being used.
>
> Signed-off-by: Luis Henriques <luis@xxxxxxxxxx>
> ---
> fs/fuse/dir.c | 139 ++++++++++++++++++++++++++++++-----------------
> fs/fuse/fuse_i.h | 9 +++
> fs/fuse/inode.c | 20 +++++--
> 3 files changed, 114 insertions(+), 54 deletions(-)
>
> diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
> index 4dfe964a491c..e3fd5d148741 100644
> --- a/fs/fuse/dir.c
> +++ b/fs/fuse/dir.c
> @@ -172,7 +172,6 @@ static void fuse_lookup_init(struct fuse_conn *fc, struct fuse_args *args,
> u64 nodeid, const struct qstr *name,
> struct fuse_entry_out *outarg)
> {
> - memset(outarg, 0, sizeof(struct fuse_entry_out));
> args->opcode = FUSE_LOOKUP;
> args->nodeid = nodeid;
> args->in_numargs = 3;
> @@ -213,7 +212,7 @@ static int fuse_dentry_revalidate(struct inode *dir, const struct qstr *name,
> goto invalid;
> else if (time_before64(fuse_dentry_time(entry), get_jiffies_64()) ||
> (flags & (LOOKUP_EXCL | LOOKUP_REVAL | LOOKUP_RENAME_TARGET))) {
> - struct fuse_entry_out outarg;
> + struct fuse_entry_out *outarg;


How about using __free(kfree) for outarg? I think it would simplify
error handling a bit?
(Still reviewing other parts.)


Thanks,
Bernd