xfs
[Top] [All Lists]

Re: REVIEW: Zero uninitialised xfs_da_args structure in xfs_dir2.c

To: Barry Naujok <bnaujok@xxxxxxx>
Subject: Re: REVIEW: Zero uninitialised xfs_da_args structure in xfs_dir2.c
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Mon, 2 Jun 2008 01:50:28 -0400
Cc: "xfs@xxxxxxxxxxx" <xfs@xxxxxxxxxxx>
In-reply-to: <op.ub3wttk53jf8g2@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
References: <op.ub3wttk53jf8g2@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.5.17 (2007-11-01)
On Mon, Jun 02, 2008 at 03:42:55PM +1000, Barry Naujok wrote:
> In particular, this patch fixes a problem in the xfs_dir2_remove and
> xfs_dir2_replace paths which internally can call a lookup function
> which will use args->cmpresult which is uninitialised.

> Index: 2.6.x-xfs/fs/xfs/xfs_dir2.c
> ===================================================================
> --- 2.6.x-xfs.orig/fs/xfs/xfs_dir2.c
> +++ 2.6.x-xfs/fs/xfs/xfs_dir2.c
> @@ -213,6 +213,7 @@ xfs_dir_createname(
>       if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum)))
>               return rval;
>       XFS_STATS_INC(xs_dir_create);
> +     memset(&args, 0, sizeof(xfs_da_args_t));
>
>       args.name = name->name;
>       args.namelen = name->len;

Doing these memsets looks good.  Stylisticly I'd rather put them
directly in front of the intialization for the actually used args
fields.


<Prev in Thread] Current Thread [Next in Thread>