From: Thorsten Blum Date: Fri, 24 Apr 2026 07:57:57 +0000 (+0200) Subject: sonypi: use strscpy() in sonypi_acpi_probe X-Git-Tag: v7.2-rc1~61^2~114 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b54a4676b3069c9a8cc68e07122e6438491a3353;p=thirdparty%2Flinux.git sonypi: use strscpy() in sonypi_acpi_probe strcpy() has been deprecated¹ because it performs no bounds checking on the destination buffer, which can lead to buffer overflows. While the current code works correctly, replace strcpy() with the safer strscpy() to follow secure coding best practices. ¹ https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy Signed-off-by: Thorsten Blum Acked-by: Arnd Bergmann Link: https://patch.msgid.link/20260424075755.305770-3-thorsten.blum@linux.dev Reviewed-by: Ilpo Järvinen Signed-off-by: Ilpo Järvinen --- diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index ccda997a9098a..959949f04f7d9 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -1120,8 +1121,8 @@ static int sonypi_acpi_probe(struct platform_device *pdev) struct acpi_device *device = ACPI_COMPANION(&pdev->dev); sonypi_acpi_device = device; - strcpy(acpi_device_name(device), "Sony laptop hotkeys"); - strcpy(acpi_device_class(device), "sony/hotkey"); + strscpy(acpi_device_name(device), "Sony laptop hotkeys"); + strscpy(acpi_device_class(device), "sony/hotkey"); return 0; }