* [PATCH] x86/common: Replace deprecated strcpy() with strscpy()
@ 2025-08-16 15:28 Thorsten Blum
2025-08-18 9:13 ` Brendan Jackman
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2025-08-16 15:28 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin, Brian Gerst, Peter Zijlstra (Intel),
Brendan Jackman, Xin Li (Intel),
Pawan Gupta, Ahmed S. Darwish
Cc: Thorsten Blum, Ingo Molnar, linux-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] x86/common: Replace deprecated strcpy() with strscpy()
2025-08-16 15:28 [PATCH] x86/common: Replace deprecated strcpy() with strscpy() Thorsten Blum
@ 2025-08-18 9:13 ` Brendan Jackman
0 siblings, 0 replies; 2+ messages in thread
From: Brendan Jackman @ 2025-08-18 9:13 UTC (permalink / raw)
To: Thorsten Blum, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, x86, H. Peter Anvin, Brian Gerst,
Peter Zijlstra (Intel), Xin Li (Intel),
Pawan Gupta, Ahmed S. Darwish
Cc: Ingo Molnar, linux-kernel
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",
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-18 9:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-16 15:28 [PATCH] x86/common: Replace deprecated strcpy() with strscpy() Thorsten Blum
2025-08-18 9:13 ` Brendan Jackman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®