lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <09d98178-2621-47c1-ace8-b7b01e610367@huawei.com>
Date: Tue, 23 Dec 2025 09:31:00 +0800
From: "lihuisong (C)" <lihuisong@...wei.com>
To: Szymon Wilczek <szymonwilczek@....com>, <linux@...ck-us.net>
CC: <linux-hwmon@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] hwmon: (acpi_power_meter) Replace deprecated strcpy()
 with strscpy()


在 2025/12/21 1:30, Szymon Wilczek 写道:
> 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@....com>
> ---
>   drivers/hwmon/acpi_power_meter.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c
> index 29ccdc2fb7ff..cfb30c68bfc5 100644
> --- a/drivers/hwmon/acpi_power_meter.c
> +++ b/drivers/hwmon/acpi_power_meter.c
> @@ -890,8 +890,8 @@ static int acpi_power_meter_add(struct acpi_device *device)
>   	resource->sensors_valid = 0;
>   	resource->acpi_dev = device;
>   	mutex_init(&resource->lock);
> -	strcpy(acpi_device_name(device), ACPI_POWER_METER_DEVICE_NAME);
> -	strcpy(acpi_device_class(device), ACPI_POWER_METER_CLASS);
> +	strscpy(acpi_device_name(device), ACPI_POWER_METER_DEVICE_NAME);
> +	strscpy(acpi_device_class(device), ACPI_POWER_METER_CLASS);
>   	device->driver_data = resource;
>   
>   #if IS_REACHABLE(CONFIG_ACPI_IPMI)
LGTM,
Reviewed-by: lihuisong@...wei.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ