On Tue 2019-09-03 15:50:19, Oleh Kravchenko wrote: > 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'. Are you sure this is correct fix? Will the name be always properly null terminated? Pavel > +++ 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; -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Attachment:
signature.asc
Description: Digital signature