Re: [PATCH] platform/surface: Replace deprecated strcpy in surface_button_add
From: Chen, Yu C
Date: Mon Jan 05 2026 - 10:03:58 EST
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.