1

ACPI: video: Use strscpy() instead of strcpy()

Replace strcpy() with strscpy() in the ACPI backlight code.

strcpy() has been deprecated because it is generally unsafe, so help to
eliminate if 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/20240703084124.11530-1-qasim.majeed20@gmail.com
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Muhammad Qasim Abdul Majeed 2024-07-03 13:41:25 +05:00 committed by Rafael J. Wysocki
parent 22a40d14b5
commit cfc38d432d

View File

@ -1128,8 +1128,8 @@ static int acpi_video_bus_get_one_device(struct acpi_device *device, void *arg)
return -ENOMEM; return -ENOMEM;
} }
strcpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME); strscpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS); strscpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
data->device_id = device_id; data->device_id = device_id;
data->video = video; data->video = video;
@ -2010,8 +2010,8 @@ static int acpi_video_bus_add(struct acpi_device *device)
} }
video->device = device; video->device = device;
strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME); strscpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME);
strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS); strscpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
device->driver_data = video; device->driver_data = video;
acpi_video_bus_find_cap(video); acpi_video_bus_find_cap(video);