diff options
author | Darrick J. Wong <djwong@kernel.org> | 2023-04-27 12:02:33 -0700 |
---|---|---|
committer | Carlos Maiolino <cem@kernel.org> | 2023-05-10 15:13:27 +0200 |
commit | f4e6c2435a673b581a4d1b6fdf12d5fe21a6cd61 (patch) | |
tree | 15e1b00ed9703d41daedd68b37533ed332122756 | |
parent | 002b5d96f1d87620db5cc3b7fa7c690a20d5e7f5 (diff) | |
download | xfsprogs-dev-f4e6c2435a673b581a4d1b6fdf12d5fe21a6cd61.tar.gz |
xfs_db: fix broken logic in error path
smatch complains proceeding into the if body if leaf is a null pointer:
check.c:3614 process_leaf_node_dir_v2_int() warn: variable dereferenced before check 'leaf' (see line 3518)
However, the logic here is misleading and broken -- what we're trying to
do is switch between the v4 and v5 variants of the directory check.
We're using @leaf3 being a null pointer (or not) to determine v4 vs. v5,
so the "!" part of the comparison is correct, but the variable used
(leaf) is not.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
-rw-r--r-- | db/check.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/db/check.c b/db/check.c index 964756d0ae..fdf1f6a1e3 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 (!leaf3 && stale != be16_to_cpu(leaf->hdr.stale)) { if (!sflag || v) dbprintf(_("dir %lld block %d stale mismatch " "%d/%d\n"), |