[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d7925076-2747-821b-bc5b-4b18b85d2937@gmail.com>
Date: Mon, 14 Aug 2023 16:56:05 +0100
From: Edward Cree <ecree.xilinx@...il.com>
To: Arnd Bergmann <arnd@...db.de>, "edward.cree" <edward.cree@....com>,
linux-net-drivers@....com, "David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>
Cc: Netdev <netdev@...r.kernel.org>, Martin Habets
<habetsm.xilinx@...il.com>, Kees Cook <keescook@...omium.org>
Subject: Re: [PATCH v2 net-next 1/3] sfc: use padding to fix alignment in
loopback test
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
Powered by blists - more mailing lists