Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: David Sterba <dsterba@suse.com>,
	linux-btrfs@vger.kernel.org, geert@linux-m68k.org
Subject: Re: [PATCH] btrfs: initialize location to fix -Wmaybe-uninitialized in btrfs_lookup_dentry()
Date: Tue, 30 Jul 2024 00:06:06 +0200	[thread overview]
Message-ID: <20240729220606.GU17473@twin.jikos.cz> (raw)
In-Reply-To: <92c6004f-9742-4abc-91bc-347cccaa44b9@gmx.com>

On Tue, Jul 30, 2024 at 07:04:36AM +0930, Qu Wenruo wrote:
> 
> 
> 在 2024/7/30 05:36, David Sterba 写道:
> > Some arch + compiler combinations report a potentially unused variable
> > location in btrfs_lookup_dentry(). This is a false alert as the variable
> > is passed by value and always valid or there's an error. The compilers
> > cannot probably reason about that although btrfs_inode_by_name() is in
> > the same file.
> >
> >     >  + /kisskb/src/fs/btrfs/inode.c: error: 'location.objectid' may be used
> >     +uninitialized in this function [-Werror=maybe-uninitialized]:  => 5603:9
> >     >  + /kisskb/src/fs/btrfs/inode.c: error: 'location.type' may be used
> >     +uninitialized in this function [-Werror=maybe-uninitialized]:  => 5674:5
> >
> >     m68k-gcc8/m68k-allmodconfig
> >     mips-gcc8/mips-allmodconfig
> >     powerpc-gcc5/powerpc-all{mod,yes}config
> >     powerpc-gcc5/ppc64_defconfig
> >
> > Initialize it to zero, this should fix the warnings and won't change the
> > behaviour as btrfs_inode_by_name() accepts only a root or inode item
> > types, otherwise returns an error.
> >
> > Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> > Link: https://lore.kernel.org/linux-btrfs/bd4e9928-17b3-9257-8ba7-6b7f9bbb639a@linux-m68k.org/
> > Signed-off-by: David Sterba <dsterba@suse.com>
> 
> Reviewed-by: Qu Wenruo <wqu@suse.com>
> 
> Although I hate to update our code for bad compilers, I guess it's
> unavoidable anyway.

Yeah, but the number of such fixups is bearable, we have added like one
per release.

  reply	other threads:[~2024-07-29 22:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-29 20:06 [PATCH] btrfs: initialize location to fix -Wmaybe-uninitialized in btrfs_lookup_dentry() David Sterba
2024-07-29 21:34 ` Qu Wenruo
2024-07-29 22:06   ` David Sterba [this message]
2024-07-30  7:09 ` Geert Uytterhoeven

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=20240729220606.GU17473@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=dsterba@suse.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.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