From: Edward Cree <ecree.xilinx@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>,
"edward.cree" <edward.cree@amd.com>,
linux-net-drivers@amd.com,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>
Cc: Netdev <netdev@vger.kernel.org>,
Martin Habets <habetsm.xilinx@gmail.com>,
Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH v2 net-next 1/3] sfc: use padding to fix alignment in loopback test
Date: Mon, 14 Aug 2023 16:56:05 +0100 [thread overview]
Message-ID: <d7925076-2747-821b-bc5b-4b18b85d2937@gmail.com> (raw)
In-Reply-To: <d5d4ae40-047c-4913-9e6f-16093e150e40@app.fastmail.com>
On 14/08/2023 14:45, Arnd Bergmann wrote:
> I think overall this is still a useful warning, in the sense that
> it can spot incorrect code elsewhere.
It's a valid concept for a warning, but it's badly implemented, because
it fires on 'defining a type' rather than 'declaring an object'.
At no point is an object of the inner (anonymous) struct type declared
(or a pointer to such constructed) without being (4n+2)-aligned, but
the compiler isn't smart enough to figure that out.
And as Linus once said[1]:
If you cannot distinguish it from incorrect uses, you shouldn't be
warning the user, because the compiler obviously doesn't know
enough to make a sufficiently educated guess.
(among other remarks on a theme of 'warnings with false positives are
worse than useless'. Especially when there's no way to shut them up
without making the code objectively worse).
-e
[1]: https://yarchive.net/comp/linux/gcc.html#11
next prev parent reply other threads:[~2023-08-14 15:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-23 18:38 [PATCH v2 net-next 0/3] sfc: fix unaligned access in loopback selftests edward.cree
2023-06-23 18:38 ` [PATCH v2 net-next 1/3] sfc: use padding to fix alignment in loopback test edward.cree
2023-08-12 8:23 ` Arnd Bergmann
2023-08-14 10:06 ` Edward Cree
2023-08-14 13:45 ` Arnd Bergmann
2023-08-14 15:56 ` Edward Cree [this message]
2023-06-23 18:38 ` [PATCH v2 net-next 2/3] sfc: siena: " edward.cree
2023-06-23 18:38 ` [PATCH v2 net-next 3/3] sfc: falcon: " edward.cree
2023-06-26 9:50 ` [PATCH v2 net-next 0/3] sfc: fix unaligned access in loopback selftests patchwork-bot+netdevbpf
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=d7925076-2747-821b-bc5b-4b18b85d2937@gmail.com \
--to=ecree.xilinx@gmail.com \
--cc=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=edward.cree@amd.com \
--cc=habetsm.xilinx@gmail.com \
--cc=keescook@chromium.org \
--cc=kuba@kernel.org \
--cc=linux-net-drivers@amd.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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;
as well as URLs for NNTP newsgroup(s).