[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2025103140-plant-sprig-bdda@gregkh>
Date: Fri, 31 Oct 2025 13:24:37 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Thorsten Blum <thorsten.blum@...ux.dev>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>,
Danilo Krummrich <dakr@...nel.org>, linux-hardening@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] platform: Replace deprecated strcpy in
platform_device_alloc
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
Powered by blists - more mailing lists