Re: [PATCH v3] net: macb: Add __nonstring annotations for unterminated strings
From: patchwork-bot+netdevbpf
Date: Wed Mar 19 2025 - 14:40:08 EST
Hello:
This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@xxxxxxxxxx>:
On Wed, 12 Mar 2025 13:07:01 -0700 you wrote:
> When a character array without a terminating NUL character has a static
> initializer, GCC 15's -Wunterminated-string-initialization will only
> warn if the array lacks the "nonstring" attribute[1]. Mark the arrays
> with __nonstring to correctly identify the char array as "not a C string"
> and thereby eliminate the warning:
>
> In file included from ../drivers/net/ethernet/cadence/macb_main.c:42:
> ../drivers/net/ethernet/cadence/macb.h:1070:35: warning: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (33 chars into 32 available) [-Wunterminated-string-initialization]
> 1070 | GEM_STAT_TITLE(TX1519CNT, "tx_greater_than_1518_byte_frames"),
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../drivers/net/ethernet/cadence/macb.h:1050:24: note: in definition of macro 'GEM_STAT_TITLE_BITS'
> 1050 | .stat_string = title, \
> | ^~~~~
> ../drivers/net/ethernet/cadence/macb.h:1070:9: note: in expansion of macro 'GEM_STAT_TITLE'
> 1070 | GEM_STAT_TITLE(TX1519CNT, "tx_greater_than_1518_byte_frames"),
> | ^~~~~~~~~~~~~~
> ../drivers/net/ethernet/cadence/macb.h:1097:35: warning: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (33 chars into 32 available) [-Wunterminated-string-initialization]
> 1097 | GEM_STAT_TITLE(RX1519CNT, "rx_greater_than_1518_byte_frames"),
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../drivers/net/ethernet/cadence/macb.h:1050:24: note: in definition of macro 'GEM_STAT_TITLE_BITS'
> 1050 | .stat_string = title, \
> | ^~~~~
> ../drivers/net/ethernet/cadence/macb.h:1097:9: note: in expansion of macro 'GEM_STAT_TITLE'
> 1097 | GEM_STAT_TITLE(RX1519CNT, "rx_greater_than_1518_byte_frames"),
> | ^~~~~~~~~~~~~~
>
> [...]
Here is the summary with links:
- [v3] net: macb: Add __nonstring annotations for unterminated strings
https://git.kernel.org/netdev/net-next/c/3d97da0ee625
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html