[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <89729468-b92a-4a3f-a2b8-f774f0937f91@intel.com>
Date: Mon, 5 Jan 2026 22:39:12 +0800
From: "Chen, Yu C" <yu.c.chen@...el.com>
To: Thorsten Blum <thorsten.blum@...ux.dev>
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 1/5/2026 9:38 PM, 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);
>
Thanks for the explanation!
Reviewed-by: Chen Yu <yu.c.chen@...el.com>
thanks,
Chenyu
> Thanks,
> Thorsten
>
Powered by blists - more mailing lists