Skip to content

Commit a713091

Browse files
tobluxGreg Ungerer
authored andcommitted
m68k: mm: Replace deprecated strncpy() with strscpy()
strncpy() is deprecated for NUL-terminated destination buffers. Use strscpy() instead and remove the manual NUL-termination. Compile-tested only. Link: KSPP#90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org> Reviewed-by: Kees Cook <kees@kernel.org> Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
1 parent 3d222eb commit a713091

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

arch/m68k/kernel/setup_mm.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,7 @@ void __init setup_arch(char **cmdline_p)
243243
setup_initial_init_mm((void *)PAGE_OFFSET, _etext, _edata, _end);
244244

245245
#if defined(CONFIG_BOOTPARAM)
246-
strncpy(m68k_command_line, CONFIG_BOOTPARAM_STRING, CL_SIZE);
247-
m68k_command_line[CL_SIZE - 1] = 0;
246+
strscpy(m68k_command_line, CONFIG_BOOTPARAM_STRING, CL_SIZE);
248247
#endif /* CONFIG_BOOTPARAM */
249248
process_uboot_commandline(&m68k_command_line[0], CL_SIZE);
250249
*cmdline_p = m68k_command_line;

0 commit comments

Comments
 (0)