On Tue, Apr 11, 2023 at 10:46:44AM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > 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@xxxxxxxxxx> > --- > 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@xxxxxxxxxx> -- Dave Chinner david@xxxxxxxxxxxxx