public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Arnd Bergmann <arnd@kernel.org>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>, Netdev <netdev@vger.kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] myri10ge: avoid uninitialized variable use
Date: Sat, 21 Jun 2025 19:10:05 +0100	[thread overview]
Message-ID: <20250621181005.GF71935@horms.kernel.org> (raw)
In-Reply-To: <75623e39-14da-4e4d-8129-790ed08b66ae@app.fastmail.com>

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@arndb.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.

      reply	other threads:[~2025-06-21 18:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-20 11:26 [PATCH] myri10ge: avoid uninitialized variable use Arnd Bergmann
2025-06-21  7:49 ` Simon Horman
2025-06-21  9:21   ` Arnd Bergmann
2025-06-21 18:10     ` Simon Horman [this message]

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=20250621181005.GF71935@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=tglx@linutronix.de \
    /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