]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: mwifiex: Add __nonstring annotations for unterminated strings
authorKees Cook <kees@kernel.org>
Mon, 10 Mar 2025 22:23:32 +0000 (15:23 -0700)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 12 Mar 2025 08:48:14 +0000 (09:48 +0100)
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
Cc: Brian Norris <briannorris@chromium.org>
Cc: Francesco Dolcini <francesco@dolcini.it>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Allison Randal <allison@lohutok.net>
Cc: linux-wireless@vger.kernel.org
Signed-off-by: Kees Cook <kees@kernel.org>
Link: https://patch.msgid.link/20250310222332.work.202-kees@kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/marvell/mwifiex/cfp.c

index d39092b9921292bf6ef4e50d0dc9a2d729a172d6..d7fd79214bcfb0c152ea19d43c5e95fb8fceba3d 100644 (file)
@@ -150,7 +150,7 @@ static const u16 ac_mcs_rate_nss2[8][10] = {
 
 struct region_code_mapping {
        u8 code;
-       u8 region[IEEE80211_COUNTRY_STRING_LEN];
+       u8 region[IEEE80211_COUNTRY_STRING_LEN] __nonstring;
 };
 
 static struct region_code_mapping region_code_mapping_t[] = {