kernel_samsung_a53x/drivers/leds/trigger
Christophe JAILLET a811e4bc69 leds: trigger: ledtrig-cpu:: Fix 'output may be truncated' issue for 'cpu'
[ Upstream commit ff50f53276131a3059e8307d11293af388ed2bcd ]

In order to teach the compiler that 'trig->name' will never be truncated,
we need to tell it that 'cpu' is not negative.

When building with W=1, this fixes the following warnings:

  drivers/leds/trigger/ledtrig-cpu.c: In function ‘ledtrig_cpu_init’:
  drivers/leds/trigger/ledtrig-cpu.c:155:56: error: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size 5 [-Werror=format-truncation=]
    155 |                 snprintf(trig->name, MAX_NAME_LEN, "cpu%d", cpu);
        |                                                        ^~
  drivers/leds/trigger/ledtrig-cpu.c:155:52: note: directive argument in the range [-2147483648, 7]
    155 |                 snprintf(trig->name, MAX_NAME_LEN, "cpu%d", cpu);
        |                                                    ^~~~~~~
  drivers/leds/trigger/ledtrig-cpu.c:155:17: note: ‘snprintf’ output between 5 and 15 bytes into a destination of size 8
    155 |                 snprintf(trig->name, MAX_NAME_LEN, "cpu%d", cpu);
        |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: 8f88731d052d ("led-triggers: create a trigger for CPU activity")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/3f4be7a99933cf8566e630da54f6ab913caac432.1695453322.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Lee Jones <lee@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-18 11:43:05 +01:00
..
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ledtrig-activity.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ledtrig-audio.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ledtrig-backlight.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ledtrig-camera.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ledtrig-cpu.c leds: trigger: ledtrig-cpu:: Fix 'output may be truncated' issue for 'cpu' 2024-11-18 11:43:05 +01:00
ledtrig-default-on.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ledtrig-disk.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ledtrig-gpio.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ledtrig-heartbeat.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ledtrig-mtd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ledtrig-netdev.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ledtrig-oneshot.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ledtrig-panic.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ledtrig-pattern.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ledtrig-timer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ledtrig-transient.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00