mirror of
https://github.com/torvalds/linux.git
synced 2025-11-01 17:18:25 +02:00
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>
This commit is contained in:
parent
be913e7c40
commit
05e8d261a3
4 changed files with 5 additions and 5 deletions
|
|
@ -535,8 +535,8 @@ static int ak8974_detect(struct ak8974 *ak8974)
|
||||||
fab_data2, sizeof(fab_data2));
|
fab_data2, sizeof(fab_data2));
|
||||||
|
|
||||||
for (i = 0; i < 3; ++i) {
|
for (i = 0; i < 3; ++i) {
|
||||||
static const char axis[3] = "XYZ";
|
static const char axis[] = "XYZ";
|
||||||
static const char pgaxis[6] = "ZYZXYX";
|
static const char pgaxis[] = "ZYZXYX";
|
||||||
unsigned offz = le16_to_cpu(fab_data2[i]) & 0x7F;
|
unsigned offz = le16_to_cpu(fab_data2[i]) & 0x7F;
|
||||||
unsigned fine = le16_to_cpu(fab_data1[i]);
|
unsigned fine = le16_to_cpu(fab_data1[i]);
|
||||||
unsigned sens = le16_to_cpu(fab_data1[i + 3]);
|
unsigned sens = le16_to_cpu(fab_data1[i + 3]);
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ struct magellan {
|
||||||
|
|
||||||
static int magellan_crunch_nibbles(unsigned char *data, int count)
|
static int magellan_crunch_nibbles(unsigned char *data, int count)
|
||||||
{
|
{
|
||||||
static unsigned char nibbles[16] = "0AB3D56GH9:K<MN?";
|
static unsigned char nibbles[16] __nonstring = "0AB3D56GH9:K<MN?";
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (data[count] == nibbles[data[count] & 0xf])
|
if (data[count] == nibbles[data[count] & 0xf])
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
#include "fwcmd.h"
|
#include "fwcmd.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
static const u8 otus_magic[4] = { OTUS_MAGIC };
|
static const u8 otus_magic[4] __nonstring = { OTUS_MAGIC };
|
||||||
|
|
||||||
static const void *carl9170_fw_find_desc(struct ar9170 *ar, const u8 descid[4],
|
static const void *carl9170_fw_find_desc(struct ar9170 *ar, const u8 descid[4],
|
||||||
const unsigned int len, const u8 compatible_revision)
|
const unsigned int len, const u8 compatible_revision)
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
static const char cachefiles_charmap[64] =
|
static const char cachefiles_charmap[64] __nonstring =
|
||||||
"0123456789" /* 0 - 9 */
|
"0123456789" /* 0 - 9 */
|
||||||
"abcdefghijklmnopqrstuvwxyz" /* 10 - 35 */
|
"abcdefghijklmnopqrstuvwxyz" /* 10 - 35 */
|
||||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" /* 36 - 61 */
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" /* 36 - 61 */
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue