[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAzmS69VFrTPzZ8DY_NPPTZYtBssocRnQOFAyo3VbSTO4CesbA@mail.gmail.com>
Date: Wed, 22 May 2019 23:58:12 -0700
From: Stephen Hines <srhines@...gle.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Nathan Chancellor <natechancellor@...il.com>,
Cliff Whickman <cpw@....com>,
Robin Holt <robinmholt@...il.com>,
Arnd Bergmann <arnd@...db.de>, linux-kernel@...r.kernel.org,
Nick Desaulniers <ndesaulniers@...gle.com>,
clang-built-linux@...glegroups.com
Subject: Re: -Wuninitialized warning in drivers/misc/sgi-xp/xpc_partition.c
Hi Nathan,
Since this kind of self-initialization is considered undefined
behavior, the simplest fix here is to just initialize to NULL. It's a
reasonable interpretation of what is currently written, and will at
least make the existing code more deterministic.
Thanks,
Steve
On Wed, May 22, 2019 at 10:53 PM Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
>
> On Wed, May 22, 2019 at 06:56:39PM -0700, Nathan Chancellor wrote:
> > On Thu, May 02, 2019 at 08:33:40PM -0700, Nathan Chancellor wrote:
> > > Hi all,
> > >
> > > When building with -Wuninitialized, Clang warns:
> > >
> > > drivers/misc/sgi-xp/xpc_partition.c:73:14: warning: variable 'buf' is uninitialized when used within its own initialization [-Wuninitialized]
> > > void *buf = buf;
> > > ~~~ ^~~
> > > 1 warning generated.
> > >
> > > I am not really sure how to properly initialize buf in this instance.
> > > I would assume it would involve xpc_kmalloc_cacheline_aligned like
> > > further down in the function but maybe not, this function isn't entirely
> > > clear. Could we get your input, this is one of the last warnings I see
> > > in a few allyesconfig builds.
> > >
> > > Thanks,
> > > Nathan
> >
> > Hi all,
> >
> > Friendly ping for comments/input. This is one of a few remaining
> > warnings I see, it'd be nice to get it fixed up so we can turn it on for
> > the whole kernel.
>
> Patches are gladly welcome :)
>
> thanks,
>
> greg k-h
>
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@...glegroups.com.
> To post to this group, send email to clang-built-linux@...glegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20190523055258.GC22946%40kroah.com.
> For more options, visit https://groups.google.com/d/optout.
Powered by blists - more mailing lists