From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: Thorsten Blum <thorsten.blum@linux.dev>
Cc: linux-hardening@vger.kernel.org, linux-mips@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/8] MIPS: arc: Replace deprecated strcpy() with memcpy()
Date: Fri, 29 Aug 2025 12:26:13 +0200 [thread overview]
Message-ID: <aLGARYWeCQxyvS1F@alpha.franken.de> (raw)
In-Reply-To: <20250817183728.612012-5-thorsten.blum@linux.dev>
On Sun, Aug 17, 2025 at 08:37:15PM +0200, Thorsten Blum wrote:
> strcpy() is deprecated; use memcpy() instead.
>
> Use pr_debug() instead of printk(KERN_DEBUG) to silence a checkpatch
> warning.
>
> Link: https://github.com/KSPP/linux/issues/88
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> arch/mips/fw/arc/cmdline.c | 22 +++++++++++++---------
> 1 file changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/arch/mips/fw/arc/cmdline.c b/arch/mips/fw/arc/cmdline.c
> index 155c5e911723..86b0e377b713 100644
> --- a/arch/mips/fw/arc/cmdline.c
> +++ b/arch/mips/fw/arc/cmdline.c
> @@ -42,12 +42,13 @@ static char __init *move_firmware_args(int argc, LONG *argv, char *cp)
> {
> char *s;
> int actr, i;
> + size_t len;
>
> actr = 1; /* Always ignore argv[0] */
>
> while (actr < argc) {
> - for(i = 0; i < ARRAY_SIZE(used_arc); i++) {
> - int len = strlen(used_arc[i][0]);
> + for (i = 0; i < ARRAY_SIZE(used_arc); i++) {
> + len = strlen(used_arc[i][0]);
>
> if (!strncmp(prom_argv(actr), used_arc[i][0], len)) {
> /* Ok, we want it. First append the replacement... */
> @@ -57,8 +58,9 @@ static char __init *move_firmware_args(int argc, LONG *argv, char *cp)
> s = strchr(prom_argv(actr), '=');
> if (s) {
> s++;
> - strcpy(cp, s);
> - cp += strlen(s);
> + len = strlen(s);
> + memcpy(cp, s, len + 1);
> + cp += len;
> }
> *cp++ = ' ';
> break;
> @@ -74,6 +76,7 @@ void __init prom_init_cmdline(int argc, LONG *argv)
> {
> char *cp;
> int actr, i;
> + size_t len;
>
> actr = 1; /* Always ignore argv[0] */
>
> @@ -86,14 +89,15 @@ void __init prom_init_cmdline(int argc, LONG *argv)
>
> while (actr < argc) {
> for (i = 0; i < ARRAY_SIZE(ignored); i++) {
> - int len = strlen(ignored[i]);
> -
> + len = strlen(ignored[i]);
> if (!strncmp(prom_argv(actr), ignored[i], len))
> goto pic_cont;
> }
> +
> /* Ok, we want it. */
> - strcpy(cp, prom_argv(actr));
> - cp += strlen(prom_argv(actr));
> + len = strlen(prom_argv(actr));
> + memcpy(cp, prom_argv(actr), len + 1);
> + cp += len;
> *cp++ = ' ';
>
> pic_cont:
> @@ -105,6 +109,6 @@ void __init prom_init_cmdline(int argc, LONG *argv)
> *cp = '\0';
>
> #ifdef DEBUG_CMDLINE
> - printk(KERN_DEBUG "prom cmdline: %s\n", arcs_cmdline);
> + pr_debug("prom cmdline: %s\n", arcs_cmdline);
> #endif
> }
> --
> 2.50.1
applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
next prev parent reply other threads:[~2025-08-29 10:31 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-17 18:37 [PATCH 1/8] MIPS: sgi-ip22: Replace deprecated strcpy() in plat_mem_setup() Thorsten Blum
2025-08-17 18:37 ` [PATCH 2/8] MIPS: sgi-ip32: " Thorsten Blum
2025-08-18 23:40 ` Justin Stitt
2025-08-19 0:33 ` Thorsten Blum
2025-08-29 10:25 ` Thomas Bogendoerfer
2025-08-17 18:37 ` [PATCH 3/8] MIPS: sni: Replace deprecated strcpy() in sni_console_setup() Thorsten Blum
2025-08-18 23:45 ` Justin Stitt
2025-08-29 10:25 ` Thomas Bogendoerfer
2025-08-17 18:37 ` [PATCH 4/8] MIPS: txx9: Replace deprecated strcpy() with strscpy() Thorsten Blum
2025-08-18 6:30 ` Geert Uytterhoeven
2025-08-29 10:25 ` Thomas Bogendoerfer
2025-08-17 18:37 ` [PATCH 5/8] MIPS: arc: Replace deprecated strcpy() with memcpy() Thorsten Blum
2025-08-18 23:58 ` Justin Stitt
2025-08-19 10:00 ` Thorsten Blum
2025-08-29 10:26 ` Thomas Bogendoerfer [this message]
2025-08-17 18:37 ` [PATCH 6/8] MIPS: octeon: Replace memset(0) + deprecated strcpy() with strscpy_pad() Thorsten Blum
2025-08-19 0:02 ` Justin Stitt
2025-08-29 10:26 ` Thomas Bogendoerfer
2025-08-17 18:37 ` [PATCH 7/8] MIPS: octeon: Replace deprecated strcpy() in octeon_model_get_string_buffer() Thorsten Blum
2025-08-29 10:26 ` Thomas Bogendoerfer
2025-08-17 18:37 ` [PATCH 8/8] MIPS: generic: Replace deprecated strcpy() in ocelot_detect() Thorsten Blum
2025-08-29 10:27 ` Thomas Bogendoerfer
2025-08-18 23:24 ` [PATCH 1/8] MIPS: sgi-ip22: Replace deprecated strcpy() in plat_mem_setup() Justin Stitt
2025-08-29 10:25 ` Thomas Bogendoerfer
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=aLGARYWeCQxyvS1F@alpha.franken.de \
--to=tsbogend@alpha.franken.de \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=thorsten.blum@linux.dev \
/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).