From: Nathan Chancellor <nat...@kernel.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

Reply via email to