Re: [PATCH] dax: use correct dev_t value
From: Arnd Bergmann
Date: Thu Sep 08 2016 - 11:03:15 EST
On Thursday, September 8, 2016 7:56:31 AM CEST Dan Williams wrote:
> On Thu, Sep 8, 2016 at 6:53 AM, Arnd Bergmann <arnd@xxxxxxxx> wrote:
> > The dev_t variable in devm_create_dax_dev() is used before it's
> > first set:
> >
> > drivers/dax/dax.c: In function 'devm_create_dax_dev':
> > drivers/dax/dax.c:205:39: error: 'dev_t' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > inode = iget5_locked(dax_superblock, hash_32(devt + DAXFS_MAGIC, 31),
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > drivers/dax/dax.c:688:8: note: 'dev_t' was declared here
> >
> > This reorders the code to how it looks correct to me.
> >
>
> Looks good to me.
>
> Strange, I don't see this error with gcc-5.3.1, I assume 0day missed
> it for a similar reason?
No, the warning is disabled by now since 6e8d666e9253 ("Disable
"maybe-uninitialized" warning globally"), which I have reverted
locally.
You can also build with -Wmaybe-uninitialized, but that causes
many false positives if any of these options are enabled:
CONFIG_CC_OPTIMIZE_FOR_SIZE
CONFIG_PROFILE_ALL_BRANCHES
CONFIG_UBSAN_SANITIZE_ALL
CONFIG_GCOV_PROFILE_ALL
I'm still trying to come up with a way to get the warning to
be useful again without annoying Linus too much.
Arnd