From: Vasily Gorbik Date: Thu, 10 Apr 2025 23:45:49 +0000 (+0200) Subject: s390/boot: Replace strncpy() with strscpy() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=1468d6b1d3803bebd36ef61b705d2c5b97015713;p=users%2Fdwmw2%2Flinux.git s390/boot: Replace strncpy() with strscpy() Replace the last 2 usages of strncpy() in s390 code with strscpy(). Signed-off-by: Vasily Gorbik Reviewed-by: Heiko Carstens Signed-off-by: Heiko Carstens --- diff --git a/arch/s390/boot/ipl_parm.c b/arch/s390/boot/ipl_parm.c index d04e9b89d14a6..16b6809e628aa 100644 --- a/arch/s390/boot/ipl_parm.c +++ b/arch/s390/boot/ipl_parm.c @@ -309,7 +309,7 @@ void parse_boot_command_line(void) if (!strcmp(param, "bootdebug")) { bootdebug = true; if (val) - strncpy(bootdebug_filter, val, sizeof(bootdebug_filter) - 1); + strscpy(bootdebug_filter, val); } if (!strcmp(param, "quiet")) boot_console_loglevel = CONSOLE_LOGLEVEL_QUIET; diff --git a/arch/s390/boot/printk.c b/arch/s390/boot/printk.c index 8cf6331bc0608..8f3b2244ef1b6 100644 --- a/arch/s390/boot/printk.c +++ b/arch/s390/boot/printk.c @@ -158,7 +158,7 @@ static noinline char *strsym(char *buf, void *ip) p = findsym((unsigned long)ip, &off, &len); if (p) { - strncpy(buf, p, MAX_SYMLEN); + strscpy(buf, p, MAX_SYMLEN); /* reserve 15 bytes for offset/len in symbol+0x1234/0x1234 */ p = buf + strnlen(buf, MAX_SYMLEN - 15); strcpy(p, "+0x");