* [PATCH] x86/cyrix: Replace deprecated strcpy() with strscpy()
@ 2025-08-16 15:29 Thorsten Blum
0 siblings, 0 replies; only message in thread
From: Thorsten Blum @ 2025-08-16 15:29 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin, Russell Senior
Cc: Thorsten Blum, Ingo Molnar, linux-kernel
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().
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/cyrix.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/cpu/cyrix.c b/arch/x86/kernel/cpu/cyrix.c
index dfec2c61e354..07521e3f94d8 100644
--- a/arch/x86/kernel/cpu/cyrix.c
+++ b/arch/x86/kernel/cpu/cyrix.c
@@ -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 */
--
2.50.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-08-16 15:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-16 15:29 [PATCH] x86/cyrix: Replace deprecated strcpy() with strscpy() Thorsten Blum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).