[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <77116abd-289e-efc6-c358-e4a1a1fc0131@linux.intel.com>
Date: Sun, 27 Jul 2025 23:32:18 +0300 (EEST)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Miguel García <miguelgarciaroman8@...il.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
cc: platform-driver-x86@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
yu.c.chen@...el.com, hansg@...nel.org, luzmaximilian@...il.com,
skhan@...uxfoundation.org
Subject: Re: [PATCH] platform/x86: surfacepro3_button: replace deprecated
strcpy() with strscpy()
On Thu, 24 Jul 2025, Miguel García wrote:
> strcpy() is deprecated for NUL-terminated strings. Replace it with
> strscpy() to guarantee NUL-termination. 'name' is a fixed-size local
> buffer.
>
> Signed-off-by: Miguel García <miguelgarciaroman8@...il.com>
> ---
> drivers/platform/surface/surfacepro3_button.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/platform/surface/surfacepro3_button.c b/drivers/platform/surface/surfacepro3_button.c
> index 2755601f979c..9616548283a1 100644
> --- a/drivers/platform/surface/surfacepro3_button.c
> +++ b/drivers/platform/surface/surfacepro3_button.c
> @@ -211,7 +211,7 @@ static int surface_button_add(struct acpi_device *device)
> }
>
> name = acpi_device_name(device);
> - strcpy(name, SURFACE_BUTTON_DEVICE_NAME);
> + strscpy(name, SURFACE_BUTTON_DEVICE_NAME, sizeof(name));
strscpy() should nowadays support 2 args variant through clever macro
trickery.
--
i.
Powered by blists - more mailing lists