Skip to contentSkip to conversation

MIPS: BCM63XX: Replace strcpy() with strscpy() in board_prom_init()

PATCH Applied Thorsten Blum 3 participants 7 messages Apr 22, 2025 – Apr 27, 2025 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: BCM63XX: Replace strcpy() with strscpy() in board_prom_init()

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

---
 arch/mips/bcm63xx/boards/board_bcm963xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/bcm63xx/boards/board_bcm963xx.c +1 -1
index 9cc8fbf218a5..c5617b889b1c 100644
@@ -764,7 +764,7 @@ void __init board_prom_init(void)
 			snprintf(cfe_version, 12, "%s", (char *) &cfe[4]);
 		}
 	} else {
-		strcpy(cfe_version, "unknown");
+		strscpy(cfe_version, "unknown");
 	}
 	pr_info("CFE version: %s\n", cfe_version);
 
Signature · 1 line
2.49.0
#1 lore raw
Quoted 5 lines · Thorsten Blum

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

Can you use --cc OR put this line...

Quoted 2 lines

---

...here (after the cutter), so we won't see this in the commit message? The list will be available in the lore archive anyway.

arch/mips/bcm63xx/boards/board_bcm963xx.c void __init board_prom_init(void) · line 768

Quoted 7 lines
arch/mips/bcm63xx/boards/board_bcm963xx.c +1 -1
@@ -764,7 +764,7 @@ void __init board_prom_init(void)
 			snprintf(cfe_version, 12, "%s", (char *) &cfe[4]);
 		}
 	} else {
-		strcpy(cfe_version, "unknown");
+		strscpy(cfe_version, "unknown");
 	}

Have you compiled this with make W=1 with recent GCCs? I would recommend to rewrite the whole function, as per commit ee44a1def7ee ("leds: core: Bail out when composed name can't fit the buffer") in Linux Next.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw

Hi Andy,

Quoted 1 line · Andy Shevchenko

Can you use --cc OR put this line...

Yes, will do next time.

Quoted 1 line

Have you compiled this with make W=1 with recent GCCs?

Yes, I compile-tested it with W=1 and mips64-linux-gnu-gcc 14.2.1.

Thanks,
Thorsten

#3 lore raw
Quoted 8 lines · Thorsten Blum
Quoted 1 line · Andy Shevchenko

Can you use --cc OR put this line...

Yes, will do next time.

Quoted 1 line

Have you compiled this with make W=1 with recent GCCs?

Yes, I compile-tested it with W=1 and mips64-linux-gnu-gcc 14.2.1.

Cool, no warnings?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw
Quoted 11 lines · Andy Shevchenko
Quoted 8 lines · Thorsten Blum
Quoted 1 line · Andy Shevchenko

Can you use --cc OR put this line...

Yes, will do next time.

Quoted 1 line

Have you compiled this with make W=1 with recent GCCs?

Yes, I compile-tested it with W=1 and mips64-linux-gnu-gcc 14.2.1.

Cool, no warnings?

No warnings, at least none related to my change or compiling board_bcm963xx.c

Best,
Thorsten

#5 lore raw
Quoted 7 lines · Thorsten Blum
Quoted 6 lines · Andy Shevchenko
Quoted 5 lines · Thorsten Blum
Quoted 1 line · Andy Shevchenko

Can you use --cc OR put this line...

Yes, will do next time.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Have you compiled this with make W=1 with recent GCCs?

Yes, I compile-tested it with W=1 and mips64-linux-gnu-gcc 14.2.1.

Cool, no warnings?

No warnings, at least none related to my change or compiling board_bcm963xx.c

Thanks for confirming!

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer Applied
#6 lore raw
In reply to Thorsten Blum
Quoted 24 lines · Thorsten Blum

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

---
 arch/mips/bcm63xx/boards/board_bcm963xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/bcm63xx/boards/board_bcm963xx.c +1 -1
index 9cc8fbf218a5..c5617b889b1c 100644
@@ -764,7 +764,7 @@ void __init board_prom_init(void)
 			snprintf(cfe_version, 12, "%s", (char *) &cfe[4]);
 		}
 	} else {
-		strcpy(cfe_version, "unknown");
+		strscpy(cfe_version, "unknown");
 	}
 	pr_info("CFE version: %s\n", cfe_version);
 
Signature · 1 line
2.49.0

applied to mips-next.

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]