From: "Chen, Yu C" <yu.c.chen@intel.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Miguel García" <miguelgarciaroman8@gmail.com>
Cc: <platform-driver-x86@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>, <hansg@kernel.org>,
<luzmaximilian@gmail.com>, <skhan@linuxfoundation.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: [PATCH] platform/x86: surfacepro3_button: replace deprecated strcpy() with strscpy()
Date: Mon, 28 Jul 2025 09:47:15 +0800 [thread overview]
Message-ID: <bba2ead6-5c08-4319-b073-198d5a3dad79@intel.com> (raw)
In-Reply-To: <77116abd-289e-efc6-c358-e4a1a1fc0131@linux.intel.com>
On 7/28/2025 4:32 AM, Ilpo Järvinen wrote:
> On Thu, 24 Jul 2025, Miguel García wrote:
>
>> strcpy() is deprecated for NUL-terminated strings. Replace it with
>> strscpy() to guarantee NUL-termination. 'name' is a fixed-size local
>> buffer.
>>
>> Signed-off-by: Miguel García <miguelgarciaroman8@gmail.com>
>> ---
>> drivers/platform/surface/surfacepro3_button.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/platform/surface/surfacepro3_button.c b/drivers/platform/surface/surfacepro3_button.c
>> index 2755601f979c..9616548283a1 100644
>> --- a/drivers/platform/surface/surfacepro3_button.c
>> +++ b/drivers/platform/surface/surfacepro3_button.c
>> @@ -211,7 +211,7 @@ static int surface_button_add(struct acpi_device *device)
>> }
>>
>> name = acpi_device_name(device);
>> - strcpy(name, SURFACE_BUTTON_DEVICE_NAME);
>> + strscpy(name, SURFACE_BUTTON_DEVICE_NAME, sizeof(name));
>
> strscpy() should nowadays support 2 args variant through clever macro
> trickery.
>
Yup, something like
strscpy(name, SURFACE_BUTTON_DEVICE_NAME);
should be fine, because
name is a array, and SURFACE_BUTTON_DEVICE_NAME is smaller than
the size of name.
thanks,
Chenyu
next prev parent reply other threads:[~2025-07-28 1:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-24 7:45 Miguel García
2025-07-27 20:32 ` Ilpo Järvinen
2025-07-28 1:47 ` Chen, Yu C [this message]
2025-07-28 5:30 ` Krzysztof Kozlowski
2025-07-28 19:49 ` [PATCH v2] " Miguel García
2025-07-28 20:11 ` [PATCH v3] " Miguel García
2025-08-19 10:00 ` Ilpo Järvinen
2025-07-29 7:38 ` [PATCH] " Miguel García Román
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=bba2ead6-5c08-4319-b073-198d5a3dad79@intel.com \
--to=yu.c.chen@intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luzmaximilian@gmail.com \
--cc=miguelgarciaroman8@gmail.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=skhan@linuxfoundation.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®