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.

EISA: Increase length of device names

GCC 15's -Wunterminated-string-initialization warned about truncated
name strings. Instead of marking them with the "nonstring" attribute[1],
increase their length to correctly include enough space for the
terminating NUL character, as they are used with %s format specifiers
when showing resource allocations in /proc/ioports:

seq_printf(m, "%*s%0*llx-%0*llx : %s\n", ..., r->name);

The strings in eisa.ids have a max length of 73, and the 50 limit was an
arbitrary limit that was removed back in 2008 with commit ca52a49846f1
("driver core: remove DEVICE_NAME_SIZE define"). Change the limit to 74
so nothing is truncated any more.

Additionally fix the Makefile to use "if_changed" instead of "cmd"
to detect changes to the command line used to generate the target,
otherwise devlist.h won't be rebuilt.

Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117178 [1]
Signed-off-by: Kees Cook <kees@kernel.org>
Acked-by: Alejandro Colomar <alx@kernel.org>
Link: https://lore.kernel.org/r/20250407172926.it.281-kees@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Kees Cook and committed by
Greg Kroah-Hartman
dd09eb0e 577f88cf

+9 -9
+4 -7
drivers/eisa/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 # Makefile for the Linux device tree 3 3 4 - obj-$(CONFIG_EISA) += eisa-bus.o 4 + obj-$(CONFIG_EISA) += devlist.h eisa-bus.o 5 5 obj-${CONFIG_EISA_PCI_EISA} += pci_eisa.o 6 6 7 7 # virtual_root.o should be the last EISA root device to initialize, ··· 9 9 obj-${CONFIG_EISA_VIRTUAL_ROOT} += virtual_root.o 10 10 11 11 12 - # Ugly hack to get DEVICE_NAME_SIZE value... 13 - DEVICE_NAME_SIZE = 50 14 - 15 12 $(obj)/eisa-bus.o: $(obj)/devlist.h 16 13 17 14 quiet_cmd_eisaid = GEN $@ 18 - cmd_eisaid = sed -e '/^\#/D' -e 's/^\([[:alnum:]]\{7\}\) \+"\([^"]\{1,$(DEVICE_NAME_SIZE)\}\).*"/EISA_DEVINFO ("\1", "\2"),/' $< > $@ 15 + cmd_eisaid = sed -e '/^\#/D' -e 's/^\([[:alnum:]]\{7\}\) \+"\([^"]*\)"/EISA_DEVINFO ("\1", "\2"),/' $< > $@ 19 16 20 17 clean-files := devlist.h 21 - $(obj)/devlist.h: $(src)/eisa.ids include/linux/device.h 22 - $(call cmd,eisaid) 18 + $(obj)/devlist.h: $(src)/eisa.ids include/linux/device.h FORCE 19 + $(call if_changed,eisaid)
+1 -1
drivers/eisa/eisa-bus.c
··· 21 21 22 22 struct eisa_device_info { 23 23 struct eisa_device_id id; 24 - char name[50]; 24 + char name[EISA_DEVICE_INFO_NAME_SIZE]; 25 25 }; 26 26 27 27 #ifdef CONFIG_EISA_NAMES
+4 -1
include/linux/eisa.h
··· 28 28 #define EISA_CONFIG_ENABLED 1 29 29 #define EISA_CONFIG_FORCED 2 30 30 31 + /* Chosen to hold the longest string in eisa.ids. */ 32 + #define EISA_DEVICE_INFO_NAME_SIZE 74 33 + 31 34 /* There is not much we can say about an EISA device, apart from 32 35 * signature, slot number, and base address. dma_mask is set by 33 36 * default to parent device mask..*/ ··· 44 41 u64 dma_mask; 45 42 struct device dev; /* generic device */ 46 43 #ifdef CONFIG_EISA_NAMES 47 - char pretty_name[50]; 44 + char pretty_name[EISA_DEVICE_INFO_NAME_SIZE]; 48 45 #endif 49 46 }; 50 47