mips: math-emu: replace deprecated strcpy() in me-debugfs
PATCH v3 1/1 mips: math-emu: replace deprecated strcpy() in me-debugfs
use strscpy() instead of deprecated strcpy().
Signed-off-by Osama Abdelkader <[email protected]>
---
v2:
change function signature to get len and the caller. v3:
use same parameters and arguments order
--- arch/mips/math-emu/me-debugfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/mips/math-emu/me-debugfs.c +3 -3
@@ -37,11 +37,11 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_fpuemu_stat, fpuemu_stat_get, NULL, "%llu\n");* used in debugfs item names to be clearly associated to corresponding * MIPS FPU instructions. */ -static void adjust_instruction_counter_name (char *out_name,char *in_name) +static void adjust_instruction_counter_name (char *out_name,char *in_name,size_t len) {int i =0 ; -strcpy (out_name, in_name); +strscpy (out_name, in_name, len);while (in_name[i] !='\0' ) {if (out_name[i] =='_' ) out_name[i] ='.' ;
@@ -226,7 +226,7 @@ do { \#define FPU_STAT_CREATE_EX (m) \ do { \ - adjust_instruction_counter_name(name, #m); \ + adjust_instruction_counter_name(name, #m, sizeof(name)); \ \ debugfs_create_file(name, 0444, fpuemu_debugfs_inst_dir, \ (void *)FPU_EMU_STAT_OFFSET(m), \
Signature · 1 line
2.43.0
Quoted 41 lines · Osama Abdelkader
use
strscpy()instead of deprecatedstrcpy().Signed-off-by Osama Abdelkader <[email protected]>---
v2:
change function signature to get len and the caller. v3:
use same parameters and arguments order--- arch/mips/math-emu/me-debugfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)arch/mips/math-emu/me-debugfs.c +3
-3@@ -37,11 +37,11 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_fpuemu_stat, fpuemu_stat_get, NULL, "%llu\n");* used in debugfs item names to be clearly associated to corresponding * MIPS FPU instructions. */ -static void adjust_instruction_counter_name (char *out_name,char *in_name) +static void adjust_instruction_counter_name (char *out_name,char *in_name,size_t len) {int i =0 ; -strcpy (out_name, in_name); +strscpy (out_name, in_name, len);while (in_name[i] !='\0' ) {if (out_name[i] =='_' ) out_name[i] ='.' ;@@ -226,7 +226,7 @@ do { \#define FPU_STAT_CREATE_EX (m) \ do { \ - adjust_instruction_counter_name(name, #m); \ + adjust_instruction_counter_name(name, #m, sizeof(name)); \ \ debugfs_create_file(name, 0444, fpuemu_debugfs_inst_dir, \ (void *)FPU_EMU_STAT_OFFSET(m), \Signature · 1 line
2.43.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 ]