From: Shankari02 <shankari.ak0208@gmail.com>
To: linux-m68k@lists.linux-m68k.org
Cc: geert@linux-m68k.org, jeanmichel.hautbois@yoseli.org,
Shankari02 <shankari.ak0208@gmail.com>
Subject: [PATCH] m68k: replace deprecated strncpy with strscpy
Date: Fri, 18 Apr 2025 01:40:13 +0530 [thread overview]
Message-ID: <20250417201013.46384-1-shankari.ak0208@gmail.com> (raw)
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@gmail.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
next reply other threads:[~2025-04-17 20:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-17 20:10 Shankari02 [this message]
2025-04-21 13:01 ` [PATCH] m68k: replace deprecated strncpy with strscpy Jean-Michel Hautbois
2025-04-21 21:00 ` Jean-Michel Hautbois
2025-04-22 6:53 ` Geert Uytterhoeven
[not found] ` <CAPRMd3m2UmfPrzD2eXW9s_Uc1kM4cwCB4pMAbSSPX+MB85=H=A@mail.gmail.com>
2025-04-23 15:42 ` Shankari
-- strict thread matches above, loose matches on Subject: below --
2025-04-16 5:31 Shankari02
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250417201013.46384-1-shankari.ak0208@gmail.com \
--to=shankari.ak0208@gmail.com \
--cc=geert@linux-m68k.org \
--cc=jeanmichel.hautbois@yoseli.org \
--cc=linux-m68k@lists.linux-m68k.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).