[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <64b35f60-2ed4-4ab0-8f4e-0dba042b4d4d@lunn.ch>
Date: Tue, 11 Mar 2025 15:12:00 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Kees Cook <kees@...nel.org>
Cc: Nicolas Ferre <nicolas.ferre@...rochip.com>,
Claudiu Beznea <claudiu.beznea@...on.dev>,
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>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] net: macb: Truncate TX1519CNT for trailing NUL
On Mon, Mar 10, 2025 at 03:24:16PM -0700, Kees Cook wrote:
> GCC 15's -Wunterminated-string-initialization saw that this string was
> being truncated. Adjust the initializer so that the needed final NUL
> character will be present.
This is where we get into the ugliness of the ethtool API for strings.
It is not actually NUL terminated. The code uses memcpy(), see:
https://elixir.bootlin.com/linux/v6.13.6/source/drivers/net/ethernet/cadence/macb_main.c#L3193
The kAPI is that userspace provides a big buffer, and the kernel then
copies these strings into the buffer at 32 byte offsets. There is no
requirement for a NUL between them since they are all 32 bytes long.
Andrew
Powered by blists - more mailing lists