diff options
author | Oleh Kravchenko <oleg@kaa.org.ua> | 2019-10-16 10:24:30 +0300 |
---|---|---|
committer | Pavel <pavel@ucw.cz> | 2019-11-03 19:39:00 +0300 |
commit | 7c6082b903ac28dc3f383fba57c6f9e7e2594178 (patch) | |
tree | 87a01387ef71938bab6ba3e6484ac37e41798f90 | |
parent | 66c41131daba0985464d8eb88092908c023ecb66 (diff) | |
download | linux-7c6082b903ac28dc3f383fba57c6f9e7e2594178.tar.xz |
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: 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>
-rw-r--r-- | drivers/leds/leds-mlxreg.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/leds/leds-mlxreg.c b/drivers/leds/leds-mlxreg.c index cabe379071a7..82aea1cd0c12 100644 --- a/drivers/leds/leds-mlxreg.c +++ b/drivers/leds/leds-mlxreg.c @@ -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; |