Skip to contentSkip to conversation

m68k: Move from strlcpy with unused retval to strscpy

PATCH Geert Uytterhoeven 1 participant 1 message Sep 30, 2022 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

CC linux-m68k

Quoted 26 lines · On Fri, Sep 30, 2022 at 10:07 AM <[email protected]> wrote:

From: Xu Panda <[email protected]>

The implementation of strscpy() is more robust and safer. That's now the recommended way to copy NUL terminated strings.

---
 arch/m68k/kernel/setup_mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/m68k/kernel/setup_mm.c +1 -2
index 06ee394db610..401a8deb6ffc 100644
@@ -231,7 +231,7 @@ void __init setup_arch(char **cmdline_p)
        setup_initial_init_mm((void *)PAGE_OFFSET, _etext, _edata, _end);
 
 #if defined(CONFIG_BOOTPARAM)
-       strncpy(m68k_command_line, CONFIG_BOOTPARAM_STRING, CL_SIZE);
+       strscpy(m68k_command_line, CONFIG_BOOTPARAM_STRING, CL_SIZE);
        m68k_command_line[CL_SIZE - 1] = 0;
 #endif /* CONFIG_BOOTPARAM */
        process_uboot_commandline(&m68k_command_line[0], CL_SIZE);
--

2.15.2