From: Borislav Petkov <bp@alien8.de>
To: Ruben Wauters <rubenru09@aol.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND] x86/cpu/intel: replace deprecated strcpy with strscpy
Date: Wed, 20 Aug 2025 16:03:52 +0200 [thread overview]
Message-ID: <20250820140352.GIaKXVyOpH6kFDKSXk@fat_crate.local> (raw)
In-Reply-To: <20250630143225.6059-1-rubenru09@aol.com>
On Mon, Jun 30, 2025 at 03:29:30PM +0100, Ruben Wauters wrote:
> strcpy is deprecated due to lack of bounds checking.
> This patch replaces strcpy with strscpy, the recommended alternative for
> null terminated strings, to follow best practices.
>
> Signed-off-by: Ruben Wauters <rubenru09@aol.com>
> ---
> This patch was reviewed by H. Peter Anvin and (by my understanding)
> was deemed ok to apply. I have not added a Reviewed-by tag as H.
> Peter Anvin did not do so.
>
> The last time I resent this patch was during the merge window so it
> understandably did not get applied or further reviewed.
> I have resent it again as the merge window has now closed, hopefully
> so it can be further reviewed and applied
> ---
> arch/x86/kernel/cpu/intel.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
> index 584dd55bf739..b49bba30434d 100644
> --- a/arch/x86/kernel/cpu/intel.c
> +++ b/arch/x86/kernel/cpu/intel.c
> @@ -607,7 +607,7 @@ static void init_intel(struct cpuinfo_x86 *c)
> }
>
> if (p)
> - strcpy(c->x86_model_id, p);
> + strscpy(c->x86_model_id, p);
> }
> #endif
"strcpy()
--------
strcpy() performs no bounds checking on the destination buffer. This
could result in linear overflows beyond the end of the buffer, leading to
all kinds of misbehaviors. While `CONFIG_FORTIFY_SOURCE=y` and various
compiler flags help reduce the risk of using this function, there is
no good reason to add new uses of this function."
From: Documentation/process/deprecated.rst
Note the "new uses of this function".
This is old code, there are no problems with it so unless I'm missing
something, if it ain't broke, there's no need to fix it.
But I'm *sure* you'll find something else in the kernel which is really broken
and you could send a fix then...
:-)
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
next prev parent reply other threads:[~2025-08-20 14:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250630143225.6059-1-rubenru09.ref@aol.com>
2025-06-30 14:29 ` Ruben Wauters
2025-08-20 14:03 ` Borislav Petkov [this message]
[not found] <20250520133549.9964-1-rubenru09.ref@aol.com>
2025-05-20 13:26 ` Ruben Wauters
2025-05-28 15:34 ` Ruben Wauters
2025-05-28 17:09 ` Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250820140352.GIaKXVyOpH6kFDKSXk@fat_crate.local \
--to=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rubenru09@aol.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®