Search Linux Wireless

Re: [PATCH] wifi: mwifiex: Add __nonstring annotations for unterminated strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 10, 2025 at 03:23:32PM -0700, Kees Cook wrote:
> 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: Brian Norris <briannorris@xxxxxxxxxxxx>
> Cc: Francesco Dolcini <francesco@xxxxxxxxxx>
> Cc: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>
> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Cc: Allison Randal <allison@xxxxxxxxxxx>
> Cc: linux-wireless@xxxxxxxxxxxxxxx
> Signed-off-by: Kees Cook <kees@xxxxxxxxxx>

This code is kinda weird, because only 2 bytes actually end up used, and
yet we explicitly initialize it with 3 non-NUL bytes.

This solutions seems fine though, as it is indeed not a C string and
does not desire nor rely on a NUL byte:

Acked-by: Brian Norris <briannorris@xxxxxxxxxxxx>

Looks like Johannes already applied it anyway.




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux