Skip to content

Commit 142acc4

Browse files
qa-majeedrafaeljw
authored andcommitted
ACPI: battery: Use strscpy() instead of strcpy()
Replace strcpy() with strscpy() in the ACPI battery driver. strcpy() has been deprecated because it is generally unsafe, so help to eliminate if from the kernel source. Link: KSPP#88 Signed-off-by: Muhammad Qasim Abdul Majeed <[email protected]> Link: https://patch.msgid.link/[email protected] [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 8400291 commit 142acc4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/acpi/battery.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,8 +1219,8 @@ static int acpi_battery_add(struct acpi_device *device)
12191219
if (!battery)
12201220
return -ENOMEM;
12211221
battery->device = device;
1222-
strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
1223-
strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
1222+
strscpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
1223+
strscpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
12241224
device->driver_data = battery;
12251225
mutex_init(&battery->lock);
12261226
mutex_init(&battery->sysfs_lock);

0 commit comments

Comments
 (0)