All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thorsten Blum <thorsten.blum@linux.dev>
To: "David S. Miller" <davem@davemloft.net>,
	Andreas Larsson <andreas@gaisler.com>,
	"Mike Rapoport (Microsoft)" <rppt@kernel.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Guo Weikang <guoweikang.kernel@gmail.com>
Cc: linux-hardening@vger.kernel.org,
	Thorsten Blum <thorsten.blum@linux.dev>,
	sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 6/8] sparc32: Replace deprecated strcpy with strscpy
Date: Mon, 22 Sep 2025 23:03:55 +0200	[thread overview]
Message-ID: <20250922210408.1723452-6-thorsten.blum@linux.dev> (raw)
In-Reply-To: <20250922210408.1723452-1-thorsten.blum@linux.dev>

strcpy() is deprecated; use strscpy() instead.

No functional changes intended.

Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 arch/sparc/kernel/prom_32.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/sparc/kernel/prom_32.c b/arch/sparc/kernel/prom_32.c
index a67dd67f10c8..cd94f1e8d644 100644
--- a/arch/sparc/kernel/prom_32.c
+++ b/arch/sparc/kernel/prom_32.c
@@ -187,14 +187,16 @@ char * __init build_path_component(struct device_node *dp)
 {
 	const char *name = of_get_property(dp, "name", NULL);
 	char tmp_buf[64], *n;
+	size_t n_sz;
 
 	tmp_buf[0] = '\0';
 	__build_path_component(dp, tmp_buf);
 	if (tmp_buf[0] == '\0')
-		strcpy(tmp_buf, name);
+		strscpy(tmp_buf, name);
 
-	n = prom_early_alloc(strlen(tmp_buf) + 1);
-	strcpy(n, tmp_buf);
+	n_sz = strlen(tmp_buf) + 1;
+	n = prom_early_alloc(n_sz);
+	strscpy(n, tmp_buf, n_sz);
 
 	return n;
 }
@@ -204,13 +206,14 @@ extern void restore_current(void);
 void __init of_console_init(void)
 {
 	char *msg = "OF stdout device is: %s\n";
+	const size_t of_console_path_sz = 256;
 	struct device_node *dp;
 	unsigned long flags;
 	const char *type;
 	phandle node;
 	int skip, tmp, fd;
 
-	of_console_path = prom_early_alloc(256);
+	of_console_path = prom_early_alloc(of_console_path_sz);
 
 	switch (prom_vers) {
 	case PROM_V0:
@@ -297,7 +300,7 @@ void __init of_console_init(void)
 				prom_printf("No stdout-path in root node.\n");
 				prom_halt();
 			}
-			strcpy(of_console_path, path);
+			strscpy(of_console_path, path, of_console_path_sz);
 		}
 		break;
 	}
-- 
2.51.0


  parent reply	other threads:[~2025-09-22 21:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-22 21:03 [PATCH 1/8] sparc: PCI: Replace deprecated strcpy with strscpy Thorsten Blum
2025-09-22 21:03 ` [PATCH 2/8] sparc: parport: Replace deprecated strcpy with strscpy in ecpp_probe Thorsten Blum
2025-09-22 21:03 ` [PATCH 3/8] sparc: floppy: Replace deprecated strcpy with strscpy in sun_floppy_init Thorsten Blum
2025-10-13 20:57   ` Andy Shevchenko
2025-09-22 21:03 ` [PATCH 4/8] sparc: Replace deprecated strcpy with strscpy in prom_nextprop Thorsten Blum
2025-09-22 21:03 ` [PATCH 5/8] sparc: Replace deprecated strcpy with strscpy Thorsten Blum
2025-09-22 21:03 ` Thorsten Blum [this message]
2025-09-22 21:03 ` [PATCH 7/8] sparc64: Replace deprecated strcpy with strscpy in build_path_component Thorsten Blum
2025-09-22 21:03 ` [PATCH 8/8] sparc: Replace deprecated strcpy with strscpy in handle_nextprop_quirks Thorsten Blum
2025-09-26 14:44 ` [PATCH 1/8] sparc: PCI: Replace deprecated strcpy with strscpy Andreas Larsson
2025-09-26 15:32   ` Andreas Larsson

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=20250922210408.1723452-6-thorsten.blum@linux.dev \
    --to=thorsten.blum@linux.dev \
    --cc=agordeev@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreas@gaisler.com \
    --cc=davem@davemloft.net \
    --cc=geert@linux-m68k.org \
    --cc=guoweikang.kernel@gmail.com \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rppt@kernel.org \
    --cc=sparclinux@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.