[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <BAED6C05-841E-4BEB-878F-6049D20669FE@linux.dev>
Date: Mon, 5 Jan 2026 14:38:22 +0100
From: Thorsten Blum <thorsten.blum@...ux.dev>
To: "Chen, Yu C" <yu.c.chen@...el.com>
Cc: Hans de Goede <hansg@...nel.org>,
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
Maximilian Luz <luzmaximilian@...il.com>,
platform-driver-x86@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] platform/surface: Replace deprecated strcpy in
surface_button_add
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);
Thanks,
Thorsten
Powered by blists - more mailing lists