Skip to content

Commit 936a25e

Browse files
keesdtor
authored andcommitted
input/joystick: magellan: Mark __nonstring look-up table
GCC 15's new -Wunterminated-string-initialization notices that the 16 character lookup table "nibbles" (which is not used as a C-String) needs to be marked as "nonstring": drivers/input/joystick/magellan.c: In function 'magellan_crunch_nibbles': drivers/input/joystick/magellan.c:51:44: warning: initializer-string for array of 'unsigned char' truncates NUL terminator but destination lacks 'nonstring' attribute (17 chars into 16 available) [-Wunterminated-string-initialization] 51 | static unsigned char nibbles[16] = "0AB3D56GH9:K<MN?"; | ^~~~~~~~~~~~~~~~~~ Add the annotation and While at it, mark the table as const too. Signed-off-by: Kees Cook <kees@kernel.org> Link: https://lore.kernel.org/r/20250416174513.work.662-kees@kernel.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 946661e commit 936a25e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/input/joystick/magellan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct magellan {
4848

4949
static int magellan_crunch_nibbles(unsigned char *data, int count)
5050
{
51-
static unsigned char nibbles[16] = "0AB3D56GH9:K<MN?";
51+
static const unsigned char nibbles[16] __nonstring = "0AB3D56GH9:K<MN?";
5252

5353
do {
5454
if (data[count] == nibbles[data[count] & 0xf])

0 commit comments

Comments
 (0)