From: Brian Foster <bfoster@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
linux-xfs@vger.kernel.org, Dave Chinner <dchinner@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] xfs: scrub: avoid uninitialized return code
Date: Thu, 2 Nov 2017 15:57:39 -0400 [thread overview]
Message-ID: <20171102195739.GK16645@bfoster.bfoster> (raw)
In-Reply-To: <20171102195306.GA4911@magnolia>
On Thu, Nov 02, 2017 at 12:53:06PM -0700, Darrick J. Wong wrote:
> 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>
> ---
Reviewed-by: Brian Foster <bfoster@redhat.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;
prev parent reply other threads:[~2017-11-02 19:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-02 19:53 [PATCH v2] xfs: scrub: avoid uninitialized return code Darrick J. Wong
2017-11-02 19:57 ` Brian Foster [this message]
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=20171102195739.GK16645@bfoster.bfoster \
--to=bfoster@redhat.com \
--cc=arnd@arndb.de \
--cc=darrick.wong@oracle.com \
--cc=dchinner@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--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 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).