From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Thorsten Blum <thorsten.blum@linux.dev>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] platform: Replace deprecated strcpy in platform_device_alloc
Date: Fri, 31 Oct 2025 13:24:37 +0100 [thread overview]
Message-ID: <2025103140-plant-sprig-bdda@gregkh> (raw)
In-Reply-To: <20251031121858.156686-2-thorsten.blum@linux.dev>
On Fri, Oct 31, 2025 at 01:18:58PM +0100, Thorsten Blum wrote:
> First, use struct_size(), which provides additional compile-time checks
> for structures with flexible array members (e.g., __must_be_array()), to
> calculate the number of bytes to allocate for a new 'platform_object'.
>
> Then, since we know the length of 'name' and that it is guaranteed to be
> NUL-terminated, replace the deprecated strcpy() with a simple memcpy().
This makes no sense. You are saying we know the length, and we know it
is NULL terminated, so let's be complex and do a strlen() and memcpy()
instead of a normal strcpy().
Please no. This is not ok at all.
greg k-h
next prev parent reply other threads:[~2025-10-31 12:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-31 12:18 Thorsten Blum
2025-10-31 12:24 ` Greg Kroah-Hartman [this message]
2025-10-31 12:50 ` Thorsten Blum
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=2025103140-plant-sprig-bdda@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=dakr@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=thorsten.blum@linux.dev \
/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®