All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@redhat.com>
To: linux-xfs@vger.kernel.org
Cc: Gao Xiang <hsiangkao@redhat.com>
Subject: [PATCH] repair: fix an uninitialized variable issue
Date: Wed, 21 Apr 2021 22:41:35 +0800	[thread overview]
Message-ID: <20210421144135.3188137-1-hsiangkao@redhat.com> (raw)

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")
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
---
 repair/phase6.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/repair/phase6.c b/repair/phase6.c
index 72287b5c..6bddfefa 100644
--- a/repair/phase6.c
+++ b/repair/phase6.c
@@ -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;
-- 
2.27.0


             reply	other threads:[~2021-04-21 14:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-21 14:41 Gao Xiang [this message]
2021-04-21 15:53 ` [PATCH] repair: fix an uninitialized variable issue Darrick J. Wong
2021-04-21 16:26   ` Eric Sandeen

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=20210421144135.3188137-1-hsiangkao@redhat.com \
    --to=hsiangkao@redhat.com \
    --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.