wifi: carl9170: Add __nonstring annotations for unterminated strings
PATCH 1/1 wifi: carl9170: Add __nonstring annotations for unterminated strings
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 and correctly identify the char array as "not a C string" and thereby eliminate the warning.
--- drivers/net/wireless/ath/carl9170/fw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/carl9170/fw.c +1 -1
@@ -15,7 +15,7 @@#include "fwcmd.h" #include "version.h" -static const u8 otus_magic[4 ] = {OTUS_MAGIC }; +static const u8 otus_magic[4] __nonstring = { OTUS_MAGIC };static const void *carl9170_fw_find_desc (struct ar9170 *ar,const u8 descid[4 ],const unsigned int len,const u8 compatible_revision)
Signature · 1 line
2.34.1
Quoted 5 lines · Kees Cook
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
__nonstringto and correctly identify the char array as "not a C string" and thereby eliminate the warning.
Sure. Thank you!
Quoted 5 lines
Cc Christian Lamparter <[email protected]>Cc Johannes Berg <[email protected]>Signed-off-by Kees Cook <[email protected]>
Quoted 17 lines
--- drivers/net/wireless/ath/carl9170/fw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/wireless/ath/carl9170/fw.c +1
-1@@ -15,7 +15,7 @@#include "fwcmd.h" #include "version.h" -static const u8 otus_magic[4 ] = {OTUS_MAGIC }; +static const u8 otus_magic[4] __nonstring = { OTUS_MAGIC };static const void *carl9170_fw_find_desc (struct ar9170 *ar,const u8 descid[4 ],const unsigned int len,const u8 compatible_revision)
Jeff Johnson
AppliedQuoted 8 lines · Kees Cook
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
__nonstringto and correctly identify the char array as "not a C string" and thereby eliminate the warning.[...]
Applied, thanks!
[1/1] wifi: carl9170: Add __nonstring annotations for unterminated strings
commit: 9a1cf85c9c7cca15bfc452f207818977621dedf8
Best regards,
Signature · 1 line
Jeff Johnson <[email protected]>