[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aca8d8cd-0e71-4544-9e04-5144dc8a6c42@intel.com>
Date: Mon, 5 Jan 2026 22:41:07 +0800
From: "Chen, Yu C" <yu.c.chen@...el.com>
To: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
CC: Hans de Goede <hansg@...nel.org>, Maximilian Luz
<luzmaximilian@...il.com>, <platform-driver-x86@...r.kernel.org>, LKML
<linux-kernel@...r.kernel.org>, Thorsten Blum <thorsten.blum@...ux.dev>
Subject: Re: [PATCH] platform/surface: Replace deprecated strcpy in
surface_button_add
On 1/5/2026 10:21 PM, Ilpo Järvinen wrote:
> On Mon, 5 Jan 2026, Thorsten Blum wrote:
>
>> On 5. Jan 2026, at 13:52, Chen, Yu C wrote:
>>>> - strcpy(name, SURFACE_BUTTON_DEVICE_NAME);
>>>> + strscpy(acpi_device_name(device), SURFACE_BUTTON_DEVICE_NAME);
>>>
>>> Thanks for the fix, a minor question might be why we do not reuse
>>> name by strscpy(name, SURFACE_BUTTON_DEVICE_NAME) ?
>>
>> Because 'name' is a 'char *' from which the size of the destination
>> buffer cannot be inferred by the 2-argument version of strscpy().
>>
>> Using 'name' would force us to use strscpy() with 3 arguments:
>>
>> strscpy(name, SURFACE_BUTTON_DEVICE_NAME, MAX_ACPI_DEVICE_NAME_LEN);
>
> I suggest you just remove 'name' instead. It seems pretty useless to begin
> with but especially after your patch. :-)
It was still used by other places.
thanks,
Chenyu
>
> Please also add () to the subject line after function names.
>
Powered by blists - more mailing lists