x86/cyrix: Replace deprecated strcpy() with strscpy()
PATCH 1/1 x86/cyrix: Replace deprecated strcpy() with strscpy()
strcpy() is deprecated; use strscpy() instead.
Remove the local variable 'char *buf' and call strscpy() directly with 'c->x86_model_id', allowing the compiler to infer the fixed size of the destination buffer using sizeof().
Signed-off-by Thorsten Blum <[email protected]>
---
Note: I already submitted this in April as part of another patch [1] which doesn't apply anymore. Submitting this again as a separate patch. [1]: https://lore.kernel.org/lkml/[email protected]/
--- arch/x86/kernel/cpu/cyrix.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/cyrix.c +3 -4
@@ -192,7 +192,6 @@ static void early_init_cyrix(struct cpuinfo_x86 *c)static void init_cyrix (struct cpuinfo_x86 *c) {unsigned char dir0, dir0_msn, dir0_lsn, dir1 =0 ; -char *buf = c->x86_model_id;const char *p =NULL ;/*
@@ -352,9 +351,9 @@ static void init_cyrix(struct cpuinfo_x86 *c) dir0_msn =7 ;break ; } -strcpy (buf, Cx86_model[dir0_msn &7 ]); +strscpy (c->x86_model_id, Cx86_model[dir0_msn &7 ]);if (p) -strcat (buf, p); +strcat (c->x86_model_id, p);return ; }
@@ -416,7 +415,7 @@ static void cyrix_identify(struct cpuinfo_x86 *c)if (c->x86 ==4 &&test_cyrix_52div ()) {unsigned char dir0, dir1; -strcpy (c->x86_vendor_id,"CyrixInstead" ); +strscpy (c->x86_vendor_id,"CyrixInstead" ); c->x86_vendor =X86_VENDOR_CYRIX ;/* Actually enable cpuid on the older cyrix */
Signature · 1 line
2.50.1