]> www.infradead.org Git - users/jedix/linux-maple.git/commit
emulex/benet: Annotate flash_cookie as nonstring
authorKees Cook <kees@kernel.org>
Wed, 16 Apr 2025 22:10:29 +0000 (15:10 -0700)
committerJakub Kicinski <kuba@kernel.org>
Wed, 23 Apr 2025 01:22:12 +0000 (18:22 -0700)
commitf0f149d9747f0d597d3e04bb87be0f31e7e25c2e
tree7ac7e8709acf17616595996ab6e130a35e28f82b
parent044412d9b67b07521414bfbad2092a63622fc087
emulex/benet: Annotate flash_cookie as nonstring

GCC 15's new -Wunterminated-string-initialization notices that the 32
character "flash_cookie" (which is not used as a C-String)
needs to be marked as "nonstring":

drivers/net/ethernet/emulex/benet/be_cmds.c:2618:51: warning: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (17 chars into 16 available) [-Wunterminated-string-initialization]
 2618 | static char flash_cookie[2][16] = {"*** SE FLAS", "H DIRECTORY *** "};
      |                                                   ^~~~~~~~~~~~~~~~~~

Add this annotation, avoid using a multidimensional array, but keep the
string split (with a comment about why). Additionally mark it const
and annotate the "cookie" member that is being memcmp()ed against as
nonstring too.

Signed-off-by: Kees Cook <kees@kernel.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250416221028.work.967-kees@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/emulex/benet/be_cmds.c
drivers/net/ethernet/emulex/benet/be_cmds.h