Commit 7c6082b9 authored by Oleh Kravchenko's avatar Oleh Kravchenko Committed by Pavel

leds: mlxreg: Fix possible buffer overflow

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: default avatarJacek Anaszewski <jacek.anaszewski@gmail.com>
Acked-by: default avatarPavel Machek <pavel@ucw.cz>
Signed-off-by: default avatarOleh Kravchenko <oleg@kaa.org.ua>
Signed-off-by: default avatarPavel Machek <pavel@ucw.cz>
parent 66c41131
...@@ -228,8 +228,8 @@ static int mlxreg_led_config(struct mlxreg_led_priv_data *priv) ...@@ -228,8 +228,8 @@ static int mlxreg_led_config(struct mlxreg_led_priv_data *priv)
brightness = LED_OFF; brightness = LED_OFF;
led_data->base_color = MLXREG_LED_GREEN_SOLID; led_data->base_color = MLXREG_LED_GREEN_SOLID;
} }
sprintf(led_data->led_cdev_name, "%s:%s", "mlxreg", snprintf(led_data->led_cdev_name, sizeof(led_data->led_cdev_name),
data->label); "mlxreg:%s", data->label);
led_cdev->name = led_data->led_cdev_name; led_cdev->name = led_data->led_cdev_name;
led_cdev->brightness = brightness; led_cdev->brightness = brightness;
led_cdev->max_brightness = LED_ON; led_cdev->max_brightness = LED_ON;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment