[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e4d801e3-3004-484b-897d-ed43c25e1576@intel.com>
Date: Tue, 5 Aug 2025 16:50:28 +0200
From: Alexander Lobakin <aleksander.lobakin@...el.com>
To: Nathan Chancellor <nathan@...nel.org>, Kees Cook <kees@...nel.org>
CC: Masahiro Yamada <masahiroy@...nel.org>, Nicolas Schier
<nicolas.schier@...ux.dev>, <linux-kbuild@...r.kernel.org>, Nick Desaulniers
<nick.desaulniers+lkml@...il.com>, Bill Wendling <morbo@...gle.com>, "Justin
Stitt" <justinstitt@...gle.com>, <linux-kernel@...r.kernel.org>,
<llvm@...ts.linux.dev>, <linux-hardening@...r.kernel.org>
Subject: Re: [PATCH v2] kbuild: Re-enable -Wunterminated-string-initialization
From: Nathan Chancellor <nathan@...nel.org>
Date: Sun, 3 Aug 2025 10:32:35 -0700
> On Sat, Aug 02, 2025 at 11:43:32AM -0700, Kees Cook wrote:
>> With the few remaining fixes now landed, we can re-enable the option
>> -Wunterminated-string-initialization (via -Wextra). Both GCC and Clang
>> have the required multi-dimensional nonstring attribute support.
[...]
> diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c
> index 55a1a96cd834..05d4323c6a13 100644
> --- a/drivers/net/ethernet/ti/netcp_ethss.c
> +++ b/drivers/net/ethernet/ti/netcp_ethss.c
> @@ -771,7 +771,7 @@ static struct netcp_module xgbe_module;
>
> /* Statistic management */
> struct netcp_ethtool_stat {
> - char desc[ETH_GSTRING_LEN];
> + char desc[ETH_GSTRING_LEN] __nonstring;
Hmmm, ETH_GSTRING_LEN is the maximum length of the driver's statistics
name to be reported to Ethtool and this *includes* \0 at the end.
If this compilation flag triggers a warning here, the driver devs need
to fix their code. There should always be \0 at the end, `desc` is a
"proper" C 0-terminated string.
> int type;
> u32 size;
> int offset;
Thanks,
Olek
Powered by blists - more mailing lists