Linux Hardening
 help / color / mirror / Atom feed
* [PATCH RESEND] sparc: PCI: Replace deprecated strcpy() with strscpy()
@ 2025-05-21 12:17 Thorsten Blum
  0 siblings, 0 replies; 6+ messages in thread
From: Thorsten Blum @ 2025-05-21 12:17 UTC (permalink / raw)
  To: David S. Miller, Andreas Larsson
  Cc: linux-hardening, Thorsten Blum, sparclinux, linux-kernel

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/pcic.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 25fe0a061732..f894ae79e78a 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -16,6 +16,7 @@
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/slab.h>
+#include <linux/string.h>
 #include <linux/jiffies.h>
 
 #include <asm/swift.h> /* for cache flushing. */
@@ -352,7 +353,7 @@ int __init pcic_probe(void)
 	pbm = &pcic->pbm;
 	pbm->prom_node = node;
 	prom_getstring(node, "name", namebuf, 63);  namebuf[63] = 0;
-	strcpy(pbm->prom_name, namebuf);
+	strscpy(pbm->prom_name, namebuf);
 
 	{
 		extern int pcic_nmi_trap_patch[4];
@@ -477,7 +478,7 @@ static void pcic_map_pci_device(struct linux_pcic *pcic,
 	int j;
 
 	if (node == 0 || node == -1) {
-		strcpy(namebuf, "???");
+		strscpy(namebuf, "???");
 	} else {
 		prom_getstring(node, "name", namebuf, 63); namebuf[63] = 0;
 	}
@@ -536,7 +537,7 @@ pcic_fill_irq(struct linux_pcic *pcic, struct pci_dev *dev, int node)
 	char namebuf[64];
 
 	if (node == 0 || node == -1) {
-		strcpy(namebuf, "???");
+		strscpy(namebuf, "???");
 	} else {
 		prom_getstring(node, "name", namebuf, sizeof(namebuf));
 	}
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH RESEND] sparc: PCI: Replace deprecated strcpy() with strscpy()
@ 2025-08-17 23:23 Thorsten Blum
  0 siblings, 0 replies; 6+ messages in thread
From: Thorsten Blum @ 2025-08-17 23:23 UTC (permalink / raw)
  To: David S. Miller, Andreas Larsson
  Cc: linux-hardening, Thorsten Blum, sparclinux, linux-kernel

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/pcic.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 25fe0a061732..f894ae79e78a 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -16,6 +16,7 @@
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/slab.h>
+#include <linux/string.h>
 #include <linux/jiffies.h>
 
 #include <asm/swift.h> /* for cache flushing. */
@@ -352,7 +353,7 @@ int __init pcic_probe(void)
 	pbm = &pcic->pbm;
 	pbm->prom_node = node;
 	prom_getstring(node, "name", namebuf, 63);  namebuf[63] = 0;
-	strcpy(pbm->prom_name, namebuf);
+	strscpy(pbm->prom_name, namebuf);
 
 	{
 		extern int pcic_nmi_trap_patch[4];
@@ -477,7 +478,7 @@ static void pcic_map_pci_device(struct linux_pcic *pcic,
 	int j;
 
 	if (node == 0 || node == -1) {
-		strcpy(namebuf, "???");
+		strscpy(namebuf, "???");
 	} else {
 		prom_getstring(node, "name", namebuf, 63); namebuf[63] = 0;
 	}
@@ -536,7 +537,7 @@ pcic_fill_irq(struct linux_pcic *pcic, struct pci_dev *dev, int node)
 	char namebuf[64];
 
 	if (node == 0 || node == -1) {
-		strcpy(namebuf, "???");
+		strscpy(namebuf, "???");
 	} else {
 		prom_getstring(node, "name", namebuf, sizeof(namebuf));
 	}
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH RESEND] sparc: PCI: Replace deprecated strcpy() with strscpy()
@ 2025-09-17 14:47 Thorsten Blum
  2025-09-17 15:50 ` Bjorn Helgaas
  0 siblings, 1 reply; 6+ messages in thread
From: Thorsten Blum @ 2025-09-17 14:47 UTC (permalink / raw)
  To: David S. Miller, Andreas Larsson, Ilpo Järvinen,
	Bjorn Helgaas
  Cc: linux-hardening, Thorsten Blum, sparclinux, linux-kernel

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/pcic.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 25fe0a061732..f894ae79e78a 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -16,6 +16,7 @@
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/slab.h>
+#include <linux/string.h>
 #include <linux/jiffies.h>
 
 #include <asm/swift.h> /* for cache flushing. */
@@ -352,7 +353,7 @@ int __init pcic_probe(void)
 	pbm = &pcic->pbm;
 	pbm->prom_node = node;
 	prom_getstring(node, "name", namebuf, 63);  namebuf[63] = 0;
-	strcpy(pbm->prom_name, namebuf);
+	strscpy(pbm->prom_name, namebuf);
 
 	{
 		extern int pcic_nmi_trap_patch[4];
@@ -477,7 +478,7 @@ static void pcic_map_pci_device(struct linux_pcic *pcic,
 	int j;
 
 	if (node == 0 || node == -1) {
-		strcpy(namebuf, "???");
+		strscpy(namebuf, "???");
 	} else {
 		prom_getstring(node, "name", namebuf, 63); namebuf[63] = 0;
 	}
@@ -536,7 +537,7 @@ pcic_fill_irq(struct linux_pcic *pcic, struct pci_dev *dev, int node)
 	char namebuf[64];
 
 	if (node == 0 || node == -1) {
-		strcpy(namebuf, "???");
+		strscpy(namebuf, "???");
 	} else {
 		prom_getstring(node, "name", namebuf, sizeof(namebuf));
 	}
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH RESEND] sparc: PCI: Replace deprecated strcpy() with strscpy()
  2025-09-17 14:47 Thorsten Blum
@ 2025-09-17 15:50 ` Bjorn Helgaas
  2025-09-19 18:13   ` Andreas Larsson
  0 siblings, 1 reply; 6+ messages in thread
From: Bjorn Helgaas @ 2025-09-17 15:50 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: David S. Miller, Andreas Larsson, Ilpo Järvinen,
	Bjorn Helgaas, linux-hardening, sparclinux, linux-kernel

On Wed, Sep 17, 2025 at 04:47:30PM +0200, Thorsten Blum wrote:
> 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>

No objection from me, but no particular PCI core issue and I don't
maintain this file, so up to the sparc folks if they want it.

I would consider making a single patch to address this issue
everywhere in arch/sparc so it can all be reviewed together.

> ---
>  arch/sparc/kernel/pcic.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
> index 25fe0a061732..f894ae79e78a 100644
> --- a/arch/sparc/kernel/pcic.c
> +++ b/arch/sparc/kernel/pcic.c
> @@ -16,6 +16,7 @@
>  #include <linux/init.h>
>  #include <linux/mm.h>
>  #include <linux/slab.h>
> +#include <linux/string.h>
>  #include <linux/jiffies.h>
>  
>  #include <asm/swift.h> /* for cache flushing. */
> @@ -352,7 +353,7 @@ int __init pcic_probe(void)
>  	pbm = &pcic->pbm;
>  	pbm->prom_node = node;
>  	prom_getstring(node, "name", namebuf, 63);  namebuf[63] = 0;
> -	strcpy(pbm->prom_name, namebuf);
> +	strscpy(pbm->prom_name, namebuf);
>  
>  	{
>  		extern int pcic_nmi_trap_patch[4];
> @@ -477,7 +478,7 @@ static void pcic_map_pci_device(struct linux_pcic *pcic,
>  	int j;
>  
>  	if (node == 0 || node == -1) {
> -		strcpy(namebuf, "???");
> +		strscpy(namebuf, "???");
>  	} else {
>  		prom_getstring(node, "name", namebuf, 63); namebuf[63] = 0;
>  	}
> @@ -536,7 +537,7 @@ pcic_fill_irq(struct linux_pcic *pcic, struct pci_dev *dev, int node)
>  	char namebuf[64];
>  
>  	if (node == 0 || node == -1) {
> -		strcpy(namebuf, "???");
> +		strscpy(namebuf, "???");
>  	} else {
>  		prom_getstring(node, "name", namebuf, sizeof(namebuf));
>  	}
> -- 
> 2.51.0
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH RESEND] sparc: PCI: Replace deprecated strcpy() with strscpy()
  2025-09-17 15:50 ` Bjorn Helgaas
@ 2025-09-19 18:13   ` Andreas Larsson
  2025-09-22 21:11     ` Thorsten Blum
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Larsson @ 2025-09-19 18:13 UTC (permalink / raw)
  To: Bjorn Helgaas, Thorsten Blum
  Cc: David S. Miller, Ilpo Järvinen, Bjorn Helgaas,
	linux-hardening, sparclinux, linux-kernel

On 2025-09-17 17:50, Bjorn Helgaas wrote:
> On Wed, Sep 17, 2025 at 04:47:30PM +0200, Thorsten Blum wrote:
>> 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>
> 
> No objection from me, but no particular PCI core issue and I don't
> maintain this file, so up to the sparc folks if they want it.
> 
> I would consider making a single patch to address this issue
> everywhere in arch/sparc so it can all be reviewed together.

Thank you and sorry for the late feedback. I agree with the above.
Thorsten, could you fix this for all occurrences of strcpy() in
arch/sparc?

Thanks,
Andreas


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH RESEND] sparc: PCI: Replace deprecated strcpy() with strscpy()
  2025-09-19 18:13   ` Andreas Larsson
@ 2025-09-22 21:11     ` Thorsten Blum
  0 siblings, 0 replies; 6+ messages in thread
From: Thorsten Blum @ 2025-09-22 21:11 UTC (permalink / raw)
  To: Andreas Larsson
  Cc: Bjorn Helgaas, David S. Miller, Ilpo Järvinen, Bjorn Helgaas,
	linux-hardening, sparclinux, linux-kernel

Hi Andreas,

On 19. Sep 2025, Andreas Larsson wrote:
> 
> 
> On 2025-09-17 17:50, Bjorn Helgaas wrote:
>> On Wed, Sep 17, 2025 at 04:47:30PM +0200, Thorsten Blum wrote:
>>> 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>
>> 
>> No objection from me, but no particular PCI core issue and I don't
>> maintain this file, so up to the sparc folks if they want it.
>> 
>> I would consider making a single patch to address this issue
>> everywhere in arch/sparc so it can all be reviewed together.
> 
> Thank you and sorry for the late feedback. I agree with the above.
> Thorsten, could you fix this for all occurrences of strcpy() in
> arch/sparc?

I just submitted a small series [1] replacing all occurrences of strcpy
in arch/sparc.

Thanks,
Thorsten

[1] https://lore.kernel.org/lkml/20250922210408.1723452-1-thorsten.blum@linux.dev/


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-09-22 21:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-21 12:17 [PATCH RESEND] sparc: PCI: Replace deprecated strcpy() with strscpy() Thorsten Blum
  -- strict thread matches above, loose matches on Subject: below --
2025-08-17 23:23 Thorsten Blum
2025-09-17 14:47 Thorsten Blum
2025-09-17 15:50 ` Bjorn Helgaas
2025-09-19 18:13   ` Andreas Larsson
2025-09-22 21:11     ` Thorsten Blum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox