Skip to content

Commit c957072

Browse files
tobluxbp3tk0v
authored andcommitted
x86/platform/olpc: Replace strcpy() with strscpy() in xo15_sci_add()
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
1 parent 6823f10 commit c957072

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

arch/x86/platform/olpc/olpc-xo15-sci.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <linux/device.h>
99
#include <linux/slab.h>
10+
#include <linux/string.h>
1011
#include <linux/workqueue.h>
1112
#include <linux/power_supply.h>
1213
#include <linux/olpc-ec.h>
@@ -144,8 +145,8 @@ static int xo15_sci_add(struct acpi_device *device)
144145
if (!device)
145146
return -EINVAL;
146147

147-
strcpy(acpi_device_name(device), XO15_SCI_DEVICE_NAME);
148-
strcpy(acpi_device_class(device), XO15_SCI_CLASS);
148+
strscpy(acpi_device_name(device), XO15_SCI_DEVICE_NAME);
149+
strscpy(acpi_device_class(device), XO15_SCI_CLASS);
149150

150151
/* Get GPE bit assignment (EC events). */
151152
status = acpi_evaluate_integer(device->handle, "_GPE", NULL, &tmp);

0 commit comments

Comments
 (0)