Skip to contentSkip to conversation

wifi: zd1211rw: Add __nonstring annotations for unterminated strings

PATCH Superseded Kees Cook 1 participant 1 message Mar 11, 2025 ZD1211RW wireless driver

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH v2 1/1 wifi: zd1211rw: 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.

---
v1: https://lore.kernel.org/lkml/[email protected]/
v2: correctly split and fix subject
Cc: Johannes Berg <[email protected]>
Cc: Miri Korenblit <[email protected]>
Cc: Alexander Wetzel <[email protected]>
Cc: Emmanuel Grumbach <[email protected]>
Cc: Shaul Triebitz <[email protected]>
Cc: [email protected]

---
 drivers/net/wireless/zydas/zd1211rw/zd_mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/zydas/zd1211rw/zd_mac.c +1 -1
index f90c33d19b39..9653dbaac3c0 100644
@@ -21,7 +21,7 @@
 
 struct zd_reg_alpha2_map {
 	u32 reg;
-	char alpha2[2];
+	char alpha2[2] __nonstring;
 };
 
 static struct zd_reg_alpha2_map reg_alpha2_map[] = {
Signature · 1 line
2.34.1