Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

gcc-15: add '__nonstring' markers to byte arrays

All of these cases are perfectly valid and good traditional C, but hit
by the "you're not NUL-terminating your byte array" warning.

And none of the cases want any terminating NUL character.

Mark them __nonstring to shut up gcc-15 (and in the case of the ak8974
magnetometer driver, I just removed the explicit array size and let gcc
expand the 3-byte and 6-byte arrays by one extra byte, because it was
the simpler change).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+5 -5
+2 -2
drivers/iio/magnetometer/ak8974.c
··· 535 535 fab_data2, sizeof(fab_data2)); 536 536 537 537 for (i = 0; i < 3; ++i) { 538 - static const char axis[3] = "XYZ"; 539 - static const char pgaxis[6] = "ZYZXYX"; 538 + static const char axis[] = "XYZ"; 539 + static const char pgaxis[] = "ZYZXYX"; 540 540 unsigned offz = le16_to_cpu(fab_data2[i]) & 0x7F; 541 541 unsigned fine = le16_to_cpu(fab_data1[i]); 542 542 unsigned sens = le16_to_cpu(fab_data1[i + 3]);
+1 -1
drivers/input/joystick/magellan.c
··· 48 48 49 49 static int magellan_crunch_nibbles(unsigned char *data, int count) 50 50 { 51 - static unsigned char nibbles[16] = "0AB3D56GH9:K<MN?"; 51 + static unsigned char nibbles[16] __nonstring = "0AB3D56GH9:K<MN?"; 52 52 53 53 do { 54 54 if (data[count] == nibbles[data[count] & 0xf])
+1 -1
drivers/net/wireless/ath/carl9170/fw.c
··· 15 15 #include "fwcmd.h" 16 16 #include "version.h" 17 17 18 - static const u8 otus_magic[4] = { OTUS_MAGIC }; 18 + static const u8 otus_magic[4] __nonstring = { OTUS_MAGIC }; 19 19 20 20 static const void *carl9170_fw_find_desc(struct ar9170 *ar, const u8 descid[4], 21 21 const unsigned int len, const u8 compatible_revision)
+1 -1
fs/cachefiles/key.c
··· 8 8 #include <linux/slab.h> 9 9 #include "internal.h" 10 10 11 - static const char cachefiles_charmap[64] = 11 + static const char cachefiles_charmap[64] __nonstring = 12 12 "0123456789" /* 0 - 9 */ 13 13 "abcdefghijklmnopqrstuvwxyz" /* 10 - 35 */ 14 14 "ABCDEFGHIJKLMNOPQRSTUVWXYZ" /* 36 - 61 */