Re: [PATCH] platform/surface: Replace deprecated strcpy in surface_button_add

From: Ilpo Järvinen
Date: Mon Jan 05 2026 - 09:31:41 EST


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. :-)

Please also add () to the subject line after function names.

--
i.