Skip to content

Commit

Permalink
m68k: mm: Replace deprecated strncpy() with strscpy()
Browse files Browse the repository at this point in the history
strncpy() is deprecated for NUL-terminated destination buffers. Use
strscpy() instead and remove the manual NUL-termination.

Compile-tested only.

Link: https://github.com/KSPP/linux/issues/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>
  • Loading branch information
Thorsten Blum authored and Greg Ungerer committed Mar 16, 2025
1 parent 3d222eb commit a713091
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions arch/m68k/kernel/setup_mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,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);
m68k_command_line[CL_SIZE - 1] = 0;
strscpy(m68k_command_line, CONFIG_BOOTPARAM_STRING, CL_SIZE);
#endif /* CONFIG_BOOTPARAM */
process_uboot_commandline(&m68k_command_line[0], CL_SIZE);
*cmdline_p = m68k_command_line;
Expand Down

0 comments on commit a713091

Please sign in to comment.