From: Kees Cook Date: Tue, 11 Mar 2025 22:55:20 +0000 (-0700) Subject: wifi: zd1211rw: Add __nonstring annotations for unterminated strings X-Git-Tag: v6.15-rc1~160^2~20^2~36 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8300f2504afeceac234027d433a2f71d4a39c7fe;p=thirdparty%2Fkernel%2Flinux.git 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. Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117178 [1] Signed-off-by: Kees Cook Link: https://patch.msgid.link/20250311225513.it.620-kees@kernel.org Signed-off-by: Johannes Berg --- diff --git a/drivers/net/wireless/zydas/zd1211rw/zd_mac.c b/drivers/net/wireless/zydas/zd1211rw/zd_mac.c index f90c33d19b399..9653dbaac3c05 100644 --- a/drivers/net/wireless/zydas/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zydas/zd1211rw/zd_mac.c @@ -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[] = {