]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
repair: fix an uninitialized variable issue
authorGao Xiang <hsiangkao@redhat.com>
Fri, 23 Apr 2021 14:20:15 +0000 (10:20 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Fri, 23 Apr 2021 14:20:15 +0000 (10:20 -0400)
An uninitialized variable issue reported by Coverity, it seems
the following for-loop can be exited in advance with isblock == 1,
and bp is still uninitialized.

In case of that, initialize bp as NULL in advance to avoid this.

Fixes: 1f7c7553489c ("repair: don't duplicate names in phase 6")
Fixes-coverity-id: 1476291
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
repair/phase6.c

index 72287b5c66caf0ebe7c08f15eefdcf5f982b8cae..6bddfefa3cb286f0f3ab075cbf0debf30765f075 100644 (file)
@@ -2195,7 +2195,7 @@ longform_dir2_entry_check(
        int                     ino_offset,
        struct dir_hash_tab     *hashtab)
 {
-       struct xfs_buf          *bp;
+       struct xfs_buf          *bp = NULL;
        xfs_dablk_t             da_bno;
        freetab_t               *freetab;
        int                     i;