x86/common: Replace deprecated strcpy() with strscpy()
PATCH 1/1 x86/common: Replace deprecated strcpy() with strscpy()
strcpy() is deprecated; use strscpy() instead.
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/common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/kernel/cpu/common.c +3 -3
@@ -184,9 +184,9 @@ static void default_init(struct cpuinfo_x86 *c)if (c->cpuid_level ==-1 ) {/* No cpuid. It must be an ancient CPU */ if (c->x86 ==4 ) -strcpy (c->x86_model_id,"486" ); +strscpy (c->x86_model_id,"486" );else if (c->x86 ==3 ) -strcpy (c->x86_model_id,"386" ); +strscpy (c->x86_model_id,"386" ); }#endif }
@@ -2013,7 +2013,7 @@ static void identify_cpu(struct cpuinfo_x86 *c)const char *p; p =table_lookup_model (c);if (p) -strcpy (c->x86_model_id, p); +strscpy (c->x86_model_id, p);else /* Last resort... */ sprintf(c->x86_model_id, "%02x/%02x",
Signature · 1 line
2.50.1
Quoted 1 line · Thorsten Blum
strcpy()is deprecated; usestrscpy()instead.
Seems like a good NOP to me.
Reviewed-by Brendan Jackman <[email protected]>
Quoted 35 lines
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/common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)arch/x86/kernel/cpu/common.c +3
-3@@ -184,9 +184,9 @@ static void default_init(struct cpuinfo_x86 *c)if (c->cpuid_level ==-1 ) {/* No cpuid. It must be an ancient CPU */ if (c->x86 ==4 ) -strcpy (c->x86_model_id,"486" ); +strscpy (c->x86_model_id,"486" );else if (c->x86 ==3 ) -strcpy (c->x86_model_id,"386" ); +strscpy (c->x86_model_id,"386" ); }#endif }@@ -2013,7 +2013,7 @@ static void identify_cpu(struct cpuinfo_x86 *c)const char *p; p =table_lookup_model (c);if (p) -strcpy (c->x86_model_id, p); +strscpy (c->x86_model_id, p);else /* Last resort... */ sprintf(c->x86_model_id, "%02x/%02x",