]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
s390/boot: Replace strncpy() with strscpy()
authorVasily Gorbik <gor@linux.ibm.com>
Thu, 10 Apr 2025 23:45:49 +0000 (01:45 +0200)
committerHeiko Carstens <hca@linux.ibm.com>
Mon, 14 Apr 2025 09:23:22 +0000 (11:23 +0200)
Replace the last 2 usages of strncpy() in s390 code with strscpy().

Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/boot/ipl_parm.c
arch/s390/boot/printk.c

index d04e9b89d14a669713a6603f9a497a6d09763b56..16b6809e628aa430ed5919b3b1b0edec82af9a6d 100644 (file)
@@ -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;
index 8cf6331bc060839fcd272dc9ac198c3cdea94329..8f3b2244ef1b66ee65e219363aaba03e482aeb5b 100644 (file)
@@ -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");