[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250416053114.693917-1-shankari.ak0208@gmail.com>
Date: Wed, 16 Apr 2025 11:01:14 +0530
From: Shankari02 <shankari.ak0208@...il.com>
To: linux-kernel@...r.kernel.org
Cc: linux-m68k@...ts.linux-m68k.org,
skhan@...uxfoundation.org,
Shankari02 <shankari.ak0208@...il.com>
Subject: [PATCH] m68k: replace deprecated strncpy with strscpy
The use of strncpy() does not guarantee NUL-termination and is deprecated
in the Linux kernel. This code manually terminates the buffer afterward,
but using strscpy() is simpler and safer.
This change replaces the strncpy() + NUL termination pattern with strscpy().
Signed-off-by: Shankari Anand <shankari.ak0208@...il.com>
---
arch/m68k/kernel/setup_mm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index 15c1a595a1de..48ce67947678 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -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;
--
2.34.1
Powered by blists - more mailing lists