[PATCH] x86/common: Replace deprecated strcpy() with strscpy()
From: Thorsten Blum
Date: Sat Aug 16 2025 - 11:29:32 EST
strcpy() is deprecated; use strscpy() instead.
Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxx>
---
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/20250425074917.1531-3-thorsten.blum@xxxxxxxxx/
---
arch/x86/kernel/cpu/common.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 34a054181c4d..8aa170762cc7 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -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",
--
2.50.1