]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/platform/olpc: Replace strcpy() with strscpy() in xo15_sci_add()
authorThorsten Blum <thorsten.blum@linux.dev>
Mon, 24 Nov 2025 12:54:53 +0000 (13:54 +0100)
committerBorislav Petkov (AMD) <bp@alien8.de>
Mon, 5 Jan 2026 14:58:57 +0000 (15:58 +0100)
strcpy() has been deprecated¹ because it performs no bounds checking on the
destination buffer, which can lead to buffer overflows. Use the safer
strscpy() instead.

  ¹ https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://patch.msgid.link/20251124125455.5495-2-thorsten.blum@linux.dev
arch/x86/platform/olpc/olpc-xo15-sci.c

index 68244a3422d1d6792630a5bcb520959e8bbecda5..82c51b6ec528891a74e18bef4abe0ae120c58f18 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <linux/device.h>
 #include <linux/slab.h>
+#include <linux/string.h>
 #include <linux/workqueue.h>
 #include <linux/power_supply.h>
 #include <linux/olpc-ec.h>
@@ -144,8 +145,8 @@ static int xo15_sci_add(struct acpi_device *device)
        if (!device)
                return -EINVAL;
 
-       strcpy(acpi_device_name(device), XO15_SCI_DEVICE_NAME);
-       strcpy(acpi_device_class(device), XO15_SCI_CLASS);
+       strscpy(acpi_device_name(device), XO15_SCI_DEVICE_NAME);
+       strscpy(acpi_device_class(device), XO15_SCI_CLASS);
 
        /* Get GPE bit assignment (EC events). */
        status = acpi_evaluate_integer(device->handle, "_GPE", NULL, &tmp);