aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThorsten Blum <thorsten.blum@linux.dev>2025-04-15 09:24:33 +0200
committerGreg Ungerer <gerg@kernel.org>2025-05-19 08:54:30 +1000
commiteb43efd062d10bacdf6b50df0e300a7049474e51 (patch)
tree3af91e5f6777d1386fb6ae523ae6d3c522b187ce
parentm68k/kernel: replace strncpy() with strscpy() (diff)
downloadlinux-rng-eb43efd062d10bacdf6b50df0e300a7049474e51.tar.xz
linux-rng-eb43efd062d10bacdf6b50df0e300a7049474e51.zip
m68k: Replace memcpy() + manual NUL-termination with strscpy()
Use strscpy() to safely copy the command-line string instead of memcpy() followed by a manual NUL-termination. The source string is also NUL-terminated and meets the __must_be_cstr() requirement of strscpy(). No functional changes intended. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
-rw-r--r--arch/m68k/kernel/setup_no.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/arch/m68k/kernel/setup_no.c b/arch/m68k/kernel/setup_no.c
index f9872098f5ca..f724875b15cc 100644
--- a/arch/m68k/kernel/setup_no.c
+++ b/arch/m68k/kernel/setup_no.c
@@ -145,8 +145,7 @@ void __init setup_arch(char **cmdline_p)
/* Keep a copy of command line */
*cmdline_p = &command_line[0];
- memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
- boot_command_line[COMMAND_LINE_SIZE-1] = 0;
+ strscpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
/*
* Give all the memory to the bootmap allocator, tell it to put the