]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
hwmon: (acpi_power_meter) Replace deprecated strcpy() with strscpy()
authorSzymon Wilczek <szymonwilczek@gmx.com>
Sat, 20 Dec 2025 17:30:41 +0000 (18:30 +0100)
committerGuenter Roeck <linux@roeck-us.net>
Sat, 31 Jan 2026 15:38:31 +0000 (07:38 -0800)
commitd4168cb6ae4f77779c8ceb1edf15b8eae95bdf7f
tree622f5025709fec24832f5e44313d7b382951df65
parent246167b17c14e8a5142368ac6457e81622055e0a
hwmon: (acpi_power_meter) Replace deprecated strcpy() with strscpy()

strcpy() performs no bounds checking on the destination buffer, which
could result in linear overflows beyond the end of the buffer. Although
the source strings here are compile-time constants that fit within the
destination buffers, using strscpy() is the preferred approach as it
provides bounds checking and aligns with the kernel's deprecated API
guidelines.

This change converts the remaining strcpy() calls to strscpy(), matching
the pattern already used throughout other ACPI drivers in
drivers/acpi/*.c.

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy
Signed-off-by: Szymon Wilczek <szymonwilczek@gmx.com>
Reviewed-by: lihuisong@huawei.com
Link: https://lore.kernel.org/r/20251220173041.377376-1-szymonwilczek@gmx.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/acpi_power_meter.c