lkml.org 
[lkml]   [2019]   [Mar]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] btrfs: work around false-positive -Wsometimes-uninitialized warning
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.

\
 
 \ /
  Last update: 2019-03-22 15:25    [W:0.027 / U:0.544 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site