https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115185
--- Comment #21 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Wentao Zhang from comment #18) > This produces warnings in kernel defconfig builds and they become errors due > to > CONFIG_WERROR. > > Cases I've observed so far: > > 1. initialization > https://elixir.bootlin.com/linux/v6.10-rc7/source/drivers/pnp/quirks.c#L412 > related definition > https://elixir.bootlin.com/linux/v6.10-rc7/source/include/linux/pnp.h#L293 That is a real bug: ``` for (f = pnp_fixups; *f->id; f++) { if (!compare_pnp_id(dev->id, f->id)) continue; ... int compare_pnp_id(struct pnp_id *pos, const char *id) { if (!pos || !id || (strlen(id) != 7)) return 0; .... ``` strlen(id) is dependent on the value of the fixup function and what endian and such. > 2. initialization > https://elixir.bootlin.com/linux/v6.10-rc7/source/drivers/acpi/nhlt.c#L23 > related definition > https://elixir.bootlin.com/linux/v6.10-rc7/source/include/acpi/actbl.h#L69 This might be ok though but maybe the warning should be disabled for this initialization (in the source). > 3. > https://elixir.bootlin.com/linux/v6.10-rc7/source/drivers/acpi/tables.c#L385 > 4. initialization > https://elixir.bootlin.com/linux/v6.10-rc7/source/drivers/acpi/acpica/ > acpredef.h#L187 > related definition > https://elixir.bootlin.com/linux/v6.10-rc7/source/drivers/acpi/acpica/ > aclocal.h#L296 This looks ok but only indirectly uses strncmp. > 5. initialization > https://elixir.bootlin.com/linux/v6.10-rc7/source/drivers/acpi/acpica/ > nsrepair.c#L66 > related definition > https://elixir.bootlin.com/linux/v6.10-rc7/source/drivers/acpi/acpica/ > aclocal.h#L373 Likewise. > 6. initialization > https://elixir.bootlin.com/linux/v6.10-rc7/source/drivers/acpi/acpica/ > nsrepair2.c#L114 > related definition > https://elixir.bootlin.com/linux/v6.10-rc7/source/drivers/acpi/acpica/ > nsrepair2.c#L28 > 7. > https://elixir.bootlin.com/linux/v6.10-rc7/source/drivers/gpu/drm/display/ > drm_dp_dual_mode_helper.c#L163 > 8. initialization > https://elixir.bootlin.com/linux/v6.10-rc7/source/drivers/power/supply/ > power_supply_sysfs.c#L182 > related definition > https://elixir.bootlin.com/linux/v6.10-rc7/source/drivers/power/supply/ > power_supply_sysfs.c#L26 > 9. https://elixir.bootlin.com/linux/v6.10-rc7/source/fs/proc/task_mmu.c#L648 This one is ok, I think. > > It still triggers the warning even if "\0" is explicitly specified and the > length is exactly MAX_PROP_NAME_LEN + 1 (31). Filed as PR 116082.