sparc: PCI: Replace deprecated strcpy() with strscpy()

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>
Reviewed-by: Andreas Larsson <andreas@gaisler.com>
Signed-off-by: Andreas Larsson <andreas@gaisler.com>
This commit is contained in:
Thorsten Blum 2025-09-22 23:03:50 +02:00 committed by Andreas Larsson
parent 3b1307e1cd
commit 59d94ea890
1 changed files with 4 additions and 3 deletions

View File

@ -16,6 +16,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/string.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <asm/swift.h> /* for cache flushing. */ #include <asm/swift.h> /* for cache flushing. */
@ -352,7 +353,7 @@ int __init pcic_probe(void)
pbm = &pcic->pbm; pbm = &pcic->pbm;
pbm->prom_node = node; pbm->prom_node = node;
prom_getstring(node, "name", namebuf, 63); namebuf[63] = 0; 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]; extern int pcic_nmi_trap_patch[4];
@ -477,7 +478,7 @@ static void pcic_map_pci_device(struct linux_pcic *pcic,
int j; int j;
if (node == 0 || node == -1) { if (node == 0 || node == -1) {
strcpy(namebuf, "???"); strscpy(namebuf, "???");
} else { } else {
prom_getstring(node, "name", namebuf, 63); namebuf[63] = 0; 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]; char namebuf[64];
if (node == 0 || node == -1) { if (node == 0 || node == -1) {
strcpy(namebuf, "???"); strscpy(namebuf, "???");
} else { } else {
prom_getstring(node, "name", namebuf, sizeof(namebuf)); prom_getstring(node, "name", namebuf, sizeof(namebuf));
} }