All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: cem@kernel.org, linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfs_db: fix inverted logic in error path
Date: Wed, 12 Apr 2023 09:59:03 +1000	[thread overview]
Message-ID: <20230411235903.GF3223426@dread.disaster.area> (raw)
In-Reply-To: <20230411174644.GI360889@frogsfrogsfrogs>

On Tue, Apr 11, 2023 at 10:46:44AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> smatch complains proceeding into the if body if leaf is a null pointer.
> This is backwards, so correct that.
> 
> check.c:3455 process_leaf_node_dir_v2_int() warn: variable dereferenced before check 'leaf'
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  db/check.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/db/check.c b/db/check.c
> index 964756d0..d5f3d225 100644
> --- a/db/check.c
> +++ b/db/check.c
> @@ -3452,7 +3452,7 @@ process_leaf_node_dir_v2_int(
>  				 id->ino, dabno, stale,
>  				 be16_to_cpu(leaf3->hdr.stale));
>  		error++;
> -	} else if (!leaf && stale != be16_to_cpu(leaf->hdr.stale)) {
> +	} else if (leaf && stale != be16_to_cpu(leaf->hdr.stale)) {
>  		if (!sflag || v)
>  			dbprintf(_("dir %lld block %d stale mismatch "
>  				 "%d/%d\n"),

Looks good. I'm surprised the compiler didn't warn about this
obviously broken code...

Reviewed-by: Dave Chinner <dchinner@redhat.com>

-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2023-04-11 23:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-11 17:46 [PATCH] xfs_db: fix inverted logic in error path Darrick J. Wong
2023-04-11 23:59 ` Dave Chinner [this message]
2023-04-12 21:43   ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230411235903.GF3223426@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=cem@kernel.org \
    --cc=djwong@kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.