Skip to contentSkip to conversation

mips: math-emu: replace deprecated strcpy() in me-debugfs

PATCH Superseded Osama Abdelkader 2 participants 3 messages Sep 1, 2025 – Sep 2, 2025 MIPS

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mips: math-emu: replace deprecated strcpy() in me-debugfs

use strscpy() instead of deprecated strcpy().

---
 arch/mips/math-emu/me-debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/math-emu/me-debugfs.c +1 -1
index d5ad76b2bb67..94667cbe18e7 100644
@@ -41,7 +41,7 @@ static void adjust_instruction_counter_name(char *out_name, char *in_name)
 {
 	int i = 0;
 
-	strcpy(out_name, in_name);
+	strscpy(out_name, in_name, sizeof(out_name));
 	while (in_name[i] != '\0') {
 		if (out_name[i] == '_')
 			out_name[i] = '.';
Signature · 1 line
2.43.0
#1 lore raw
Quoted 12 lines · Osama Abdelkader

use strscpy() instead of deprecated strcpy().

---
 arch/mips/math-emu/me-debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/math-emu/me-debugfs.c +0 -0
index d5ad76b2bb67..94667cbe18e7 100644

arch/mips/math-emu/me-debugfs.c static void adjust_instruction_counter_name(char *out_name, char *in_name) · line 44

Quoted 5 lines
arch/mips/math-emu/me-debugfs.c +1 -1
@@ -41,7 +41,7 @@ static void adjust_instruction_counter_name(char *out_name, char *in_name)
 {
 	int i = 0;
 
-	strcpy(out_name, in_name);
+	strscpy(out_name, in_name, sizeof(out_name));

this is wrong. sizeof(out_name) is the size of the pointer, but not the size of the storage behind it. To be able to use strscpy() here you need to pass in the size of the given buffer and use that.

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]
#2 lore raw
Quoted 16 lines · Thomas Bogendoerfer
Quoted 15 lines · Osama Abdelkader

use strscpy() instead of deprecated strcpy().

---
 arch/mips/math-emu/me-debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/math-emu/me-debugfs.c +0 -0
index d5ad76b2bb67..94667cbe18e7 100644
@@ -41,7 +41,7 @@ static void adjust_instruction_counter_name(char *out_name, char *in_name)
 {
 	int i = 0;
 
Quoted 9 lines

arch/mips/math-emu/me-debugfs.c static void adjust_instruction_counter_name(char *out_name, char *in_name) · line 44

Quoted 2 lines
arch/mips/math-emu/me-debugfs.c +1 -1
-	strcpy(out_name, in_name);
+	strscpy(out_name, in_name, sizeof(out_name));

this is wrong. sizeof(out_name) is the size of the pointer, but not the size of the storage behind it. To be able to use strscpy() here you need to pass in the size of the given buffer and use that.

Thomas.

Thanks Thomas, I just sent v2.

Regards,
Osama

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