linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] xfs: scrub: avoid uninitialized return code
@ 2017-11-02 19:53 Darrick J. Wong
  2017-11-02 19:57 ` Brian Foster
  0 siblings, 1 reply; 2+ messages in thread
From: Darrick J. Wong @ 2017-11-02 19:53 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-xfs, Dave Chinner, linux-kernel, Brian Foster

From: Darrick J. Wong <darrick.wong@oracle.com>

The newly added xfs_scrub_da_btree_block() function has one code path
that returns the 'error' variable without initializing it first, as
shown by this compiler warning:

fs/xfs/scrub/dabtree.c: In function 'xfs_scrub_da_btree_block':
fs/xfs/scrub/dabtree.c:462:9: error: 'error' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Return zero since the caller will exit the scrub code if we don't produce a
buffer pointer.

Fixes: 7c4a07a424c1 ("xfs: scrub directory/attribute btrees")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/scrub/dabtree.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/scrub/dabtree.c b/fs/xfs/scrub/dabtree.c
index c21c528..4c9839c 100644
--- a/fs/xfs/scrub/dabtree.c
+++ b/fs/xfs/scrub/dabtree.c
@@ -336,7 +336,7 @@ xfs_scrub_da_btree_block(
 	xfs_ino_t			owner;
 	int				*pmaxrecs;
 	struct xfs_da3_icnode_hdr	nodehdr;
-	int				error;
+	int				error = 0;
 
 	blk = &ds->state->path.blk[level];
 	ds->state->path.active = level + 1;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-02 19:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-02 19:53 [PATCH v2] xfs: scrub: avoid uninitialized return code Darrick J. Wong
2017-11-02 19:57 ` Brian Foster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).