[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250621181005.GF71935@horms.kernel.org>
Date: Sat, 21 Jun 2025 19:10:05 +0100
From: Simon Horman <horms@...nel.org>
To: Arnd Bergmann <arnd@...db.de>
Cc: Arnd Bergmann <arnd@...nel.org>, Andrew Lunn <andrew+netdev@...n.ch>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>, Netdev <netdev@...r.kernel.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] myri10ge: avoid uninitialized variable use
On Sat, Jun 21, 2025 at 11:21:09AM +0200, Arnd Bergmann wrote:
> On Sat, Jun 21, 2025, at 09:49, Simon Horman wrote:
> > On Fri, Jun 20, 2025 at 01:26:28PM +0200, Arnd Bergmann wrote:
> >>
> >> It would be nice to understand how to make other compilers catch this as
> >> well, but for the moment I'll just shut up the warning by fixing the
> >> undefined behavior in this driver.
> >>
> >> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> >
> > Hi Arnd,
> >
> > That is a lovely mess.
> >
> > Curiously I was not able to reproduce this on s390 with gcc 10.5.0.
> > Perhaps I needed to try harder. Or perhaps the detection is specific to a
> > very narrow set of GCC versions.
>
> I was using my gcc binaries from
> https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/arm64/10.5.0/
> but more likely this is kernel configuration specific than the exact
> toolchain version.
>
> The warning clearly depends on the myri10ge_send_cmd() function getting
> inlined into the caller, and inlining is highly configuration specific.
>
> See https://pastebin.com/T23wHkCx for the .config I used to produce
> this.
Thanks Arnd.
FWIIW, I was also using the above mentioned toolchain. But with allmodconfig.
Now I'm using the config at the link above I see the warnings too.
In any case, it seems pretty clear to me from looking at the code that your
analysis is correct. The mystery to me is why it isn't more widely
detected by tooling.
>
> > Regardless I agree with your analysis, but I wonder if the following is
> > also needed so that .data0, 1 and 2 are always initialised when used.
>
> Right, I stopped adding initializations when all the warnings were
> gone, so I missed the ones you found. ;-)
I thought that might have happened :)
> I've integrated your changes now, let me know if I should resend it
> right away, or you want to play around with that .config some more
> first and reproduce the warning.
Feel free to post whenever you are ready.
Powered by blists - more mailing lists