From: Kees Cook <kees@kernel.org>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>,
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>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH v3] net: macb: Add __nonstring annotations for unterminated strings
Date: Thu, 13 Mar 2025 10:44:09 -0700 [thread overview]
Message-ID: <202503131042.F6C9F4CA06@keescook> (raw)
In-Reply-To: <634dbbef-d7c0-41ec-8614-efee824142a9@lunn.ch>
On Thu, Mar 13, 2025 at 02:25:09PM +0100, Andrew Lunn wrote:
> > struct gem_statistic {
> > - char stat_string[ETH_GSTRING_LEN];
> > + char stat_string[ETH_GSTRING_LEN] __nonstring;
>
> This general pattern of a char foo[ETH_GSTRING_LEN]' will appear
> throughout drivers/net/ethernet. Maybe Coccinelle can find them all
> and add the __nonstring ?
I had that same thought but then rediscovered ethtool_puts() and
ethtool_sprintf(), which operate on C Strings and write out C Strings...
so _some_ ethtool stats are being constructed in a way that we can't
just universally apply __nonstring to all ETH_GSTRING_LEN strings. :(
--
Kees Cook
next prev parent reply other threads:[~2025-03-13 17:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-12 20:07 [PATCH v3] net: macb: Add __nonstring annotations for unterminated strings Kees Cook
2025-03-12 22:57 ` Jacob Keller
2025-03-13 13:25 ` Andrew Lunn
2025-03-13 17:44 ` Kees Cook [this message]
2025-03-19 18:40 ` 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=202503131042.F6C9F4CA06@keescook \
--to=kees@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=claudiu.beznea@tuxon.dev \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.