arch/x86/kernel/cpu/common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
strcpy() is deprecated; use strscpy() instead.
Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
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@linux.dev/
---
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
On Sat Aug 16, 2025 at 3:28 PM UTC, Thorsten Blum wrote:
> strcpy() is deprecated; use strscpy() instead.
Seems like a good NOP to me.
Reviewed-By: Brendan Jackman <jackmanb@google.com>
> Link: https://github.com/KSPP/linux/issues/88
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> 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@linux.dev/
> ---
> 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",
© 2016 - 2026 Red Hat, Inc.