From: David Sterba <dsterba@suse.cz>
To: Nikolay Borisov <nborisov@suse.com>
Cc: Arnd Bergmann <arnd@arndb.de>, Chris Mason <clm@fb.com>,
Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>,
clang-built-linux@googlegroups.com,
Nick Desaulniers <ndesaulniers@google.com>,
Nathan Chancellor <natechancellor@gmail.com>,
Lu Fengqi <lufq.fnst@cn.fujitsu.com>,
Anand Jain <anand.jain@oracle.com>,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] btrfs: work around false-positive -Wsometimes-uninitialized warning
Date: Fri, 22 Mar 2019 15:25:40 +0100 [thread overview]
Message-ID: <20190322142540.GC28481@twin.jikos.cz> (raw)
In-Reply-To: <57833895-fce3-75bc-a28e-6bdc6d14ea8c@suse.com>
On Fri, Mar 22, 2019 at 04:11:52PM +0200, Nikolay Borisov wrote:
>
>
> On 22.03.19 г. 16:07 ч., Arnd Bergmann wrote:
> > clang fails to see that the last 'else if() in btrfs_uuid_tree_add()
> > is always true, so 'eb' is always initialized correctly:
> >
> > fs/btrfs/uuid-tree.c:129:13: error: variable 'eb' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
> > } else if (ret < 0) {
> > ^~~~~~~
> > fs/btrfs/uuid-tree.c:139:22: note: uninitialized use occurs here
> > write_extent_buffer(eb, &subid_le, offset, sizeof(subid_le));
> > ^~
> > fs/btrfs/uuid-tree.c:129:9: note: remove the 'if' if its condition is always true
> > } else if (ret < 0) {
> > ^~~~~~~~~~~~~
> > fs/btrfs/uuid-tree.c:90:26: note: initialize the variable 'eb' to silence this warning
> > struct extent_buffer *eb;
> > ^
> > = NULL
> >
> > Change it into a plain 'else' to shut up that warning.
> >
> > Link: https://bugs.llvm.org/show_bug.cgi?id=41197
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> Such a patch has already been merged to misc-next:
>
> f22898caa6a5 ("btrfs: Turn an 'else if' into an 'else' in
> btrfs_uuid_tree_add")
I haven't updated for-next for a few days so the patch was not so
visible outside, will push an update today.
prev parent reply other threads:[~2019-03-22 14:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-22 14:07 [PATCH] btrfs: work around false-positive -Wsometimes-uninitialized warning Arnd Bergmann
2019-03-22 14:11 ` Nikolay Borisov
2019-03-22 14:25 ` David Sterba [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=20190322142540.GC28481@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=anand.jain@oracle.com \
--cc=arnd@arndb.de \
--cc=clang-built-linux@googlegroups.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lufq.fnst@cn.fujitsu.com \
--cc=natechancellor@gmail.com \
--cc=nborisov@suse.com \
--cc=ndesaulniers@google.com \
/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