]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ACPI: pci_root: Use strscpy() instead of strcpy()
authorMuhammad Qasim Abdul Majeed <qasim.majeed20@gmail.com>
Sun, 15 Sep 2024 18:38:17 +0000 (23:38 +0500)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 5 Nov 2024 20:35:36 +0000 (21:35 +0100)
Replace strcpy() with strscpy() in the ACPI pci_root driver.

strcpy() has been deprecated because it is generally unsafe, so it
is better to eliminate it from the kernel source.

Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Muhammad Qasim Abdul Majeed <qasim.majeed20@gmail.com>
Link: https://patch.msgid.link/20240915183822.34588-5-qasim.majeed20@gmail.com
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/pci_root.c

index d0bfb3706801989bbc388a37fae4a88b98937bd0..d0b6a024daaecadb230fe7f16b078d17e56199c2 100644 (file)
@@ -689,8 +689,8 @@ static int acpi_pci_root_add(struct acpi_device *device,
 
        root->device = device;
        root->segment = segment & 0xFFFF;
-       strcpy(acpi_device_name(device), ACPI_PCI_ROOT_DEVICE_NAME);
-       strcpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS);
+       strscpy(acpi_device_name(device), ACPI_PCI_ROOT_DEVICE_NAME);
+       strscpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS);
        device->driver_data = root;
 
        if (hotadd && dmar_device_add(handle)) {