Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

parisc: led: Use scnprintf() to avoid string truncation warning

We intentionally truncate the string and store only up to 20 characters
since the LCD display does not provide more chars. For that use
scnprintf() instead of snprintf() to avoid the warning.

Signed-off-by: Helge Deller <deller@gmx.de>

+1 -3
+1 -3
drivers/parisc/led.c
··· 39 39 static unsigned char lastleds; /* LED state from most recent update */ 40 40 static unsigned char lcd_new_text; 41 41 static unsigned char lcd_text[20]; 42 - static unsigned char lcd_text_default[20]; 43 42 static unsigned char lcd_no_led_support; /* KittyHawk doesn't support LED on its LCD */ 44 43 45 44 struct lcd_block { ··· 455 456 struct pdc_chassis_info chassis_info; 456 457 int ret; 457 458 458 - snprintf(lcd_text_default, sizeof(lcd_text_default), 459 + scnprintf(lcd_text, sizeof(lcd_text), 459 460 "Linux %s", init_utsname()->release); 460 - strcpy(lcd_text, lcd_text_default); 461 461 lcd_new_text = 1; 462 462 463 463 /* Work around the buggy PDC of KittyHawk-machines */