xfs
[Top] [All Lists]

Re: [PATCH] xfs:xfs_dir2_node.c: pointer use before check for null

To: Denis Efremov <yefremov.denis@xxxxxxxxx>
Subject: Re: [PATCH] xfs:xfs_dir2_node.c: pointer use before check for null
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Wed, 23 Oct 2013 07:33:22 +1100
Cc: Ben Myers <bpm@xxxxxxx>, ldv-project@xxxxxxxxxxxxxxxx, Alex Elder <elder@xxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1382427375-8863-1-git-send-email-yefremov.denis@xxxxxxxxx>
References: <1382427375-8863-1-git-send-email-yefremov.denis@xxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Tue, Oct 22, 2013 at 11:36:15AM +0400, Denis Efremov wrote:
> Reorder of assert and args pointer dereference.
> 
> Found by Linux Driver Verification project (linuxtesting.org) -
> PVS-Studio analyzer.
> 
> Signed-off-by: Denis Efremov <yefremov.denis@xxxxxxxxx>
> ---
>  fs/xfs/xfs_dir2_node.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c
> index 4c3dba7..0ba7382 100644
> --- a/fs/xfs/xfs_dir2_node.c
> +++ b/fs/xfs/xfs_dir2_node.c
> @@ -1365,8 +1365,8 @@ xfs_dir2_leafn_split(
>        * Allocate space for a new leaf node.
>        */
>       args = state->args;
> -     mp = args->dp->i_mount;
>       ASSERT(args != NULL);
> +     mp = args->dp->i_mount;

Just remove the ASSERT. Either way we are going to panic.

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

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