]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ACPI: power: Use strscpy() instead of strcpy()
authorMuhammad Qasim Abdul Majeed <qasim.majeed20@gmail.com>
Sun, 15 Sep 2024 18:38:18 +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 power resource 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-6-qasim.majeed20@gmail.com
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/power.c

index c2c70139c4f1d9fa864238bcdc2f7b3acc59be9b..25174c24d3d757627d6cb8a04bcc49b8b8e4d340 100644 (file)
@@ -950,8 +950,8 @@ struct acpi_device *acpi_add_power_resource(acpi_handle handle)
        mutex_init(&resource->resource_lock);
        INIT_LIST_HEAD(&resource->list_node);
        INIT_LIST_HEAD(&resource->dependents);
-       strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME);
-       strcpy(acpi_device_class(device), ACPI_POWER_CLASS);
+       strscpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME);
+       strscpy(acpi_device_class(device), ACPI_POWER_CLASS);
        device->power.state = ACPI_STATE_UNKNOWN;
        device->flags.match_driver = true;