Re: [PATCH] iio: magnetometer: ak8974: Add __nonstring annotations for unterminated strings
From: Linus Walleij
Date: Fri Mar 14 2025 - 06:31:37 EST
On Mon, Mar 10, 2025 at 11:23 PM Kees Cook <kees@xxxxxxxxxx> 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: Linus Walleij <linus.walleij@xxxxxxxxxx>
> Cc: Jonathan Cameron <jic23@xxxxxxxxxx>
> Cc: Lars-Peter Clausen <lars@xxxxxxxxxx>
> Cc: linux-iio@xxxxxxxxxxxxxxx
> Signed-off-by: Kees Cook <kees@xxxxxxxxxx>
Fair enough,
Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
Yours,
Linus Walleij