From: Kees Cook Date: Mon, 10 Mar 2025 22:22:58 +0000 (-0700) Subject: wifi: rtw88: Add __nonstring annotations for unterminated strings X-Git-Tag: io_uring-6.15-20250403~82^2~20^2~2^2 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=d58ad77d5cc2a6d04db622a898e54d93fc7002a2;p=linux-block.git wifi: rtw88: 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] Cc: Ping-Ke Shih Cc: Johannes Berg Cc: linux-wireless@vger.kernel.org Signed-off-by: Kees Cook Signed-off-by: Ping-Ke Shih Link: https://patch.msgid.link/20250310222257.work.866-kees@kernel.org --- diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h index c15e0f55d09a..02343e059fd9 100644 --- a/drivers/net/wireless/realtek/rtw88/main.h +++ b/drivers/net/wireless/realtek/rtw88/main.h @@ -835,7 +835,7 @@ struct rtw_vif { }; struct rtw_regulatory { - char alpha2[2]; + char alpha2[2] __nonstring; u8 txpwr_regd_2g; u8 txpwr_regd_5g; };