mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 19:29:37 +00:00
leds: mlxreg: Fix possible buffer overflow
[ Upstream commit 7c6082b903
]
Error was detected by PVS-Studio:
V512 A call of the 'sprintf' function will lead to overflow of
the buffer 'led_data->led_cdev_name'.
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
36f11775da
commit
e645b649c4
1 changed files with 2 additions and 2 deletions
|
@ -228,8 +228,8 @@ static int mlxreg_led_config(struct mlxreg_led_priv_data *priv)
|
|||
brightness = LED_OFF;
|
||||
led_data->base_color = MLXREG_LED_GREEN_SOLID;
|
||||
}
|
||||
sprintf(led_data->led_cdev_name, "%s:%s", "mlxreg",
|
||||
data->label);
|
||||
snprintf(led_data->led_cdev_name, sizeof(led_data->led_cdev_name),
|
||||
"mlxreg:%s", data->label);
|
||||
led_cdev->name = led_data->led_cdev_name;
|
||||
led_cdev->brightness = brightness;
|
||||
led_cdev->max_brightness = LED_ON;
|
||||
|
|
Loading…
Reference in a new issue