[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0jfQjCUip1R5RCCyB0BaTfhJ1nqQ0x7Qg5kMjdCJB+FTQ@mail.gmail.com>
Date: Thu, 15 Jan 2026 21:09:37 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Thorsten Blum <thorsten.blum@...ux.dev>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Daniel Lezcano <daniel.lezcano@...aro.org>,
Zhang Rui <rui.zhang@...el.com>, Lukasz Luba <lukasz.luba@....com>, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] thermal: sysfs: Replace snprintf with strscpy in policy_store
On Mon, Jan 12, 2026 at 6:49 PM Thorsten Blum <thorsten.blum@...ux.dev> wrote:
>
> There is no need to use snprintf with a format specifier to copy 'buf'
> to 'name'; use strscpy() directly instead.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
> ---
> drivers/thermal/thermal_sysfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
> index d80612506a33..e9580ddf4882 100644
> --- a/drivers/thermal/thermal_sysfs.c
> +++ b/drivers/thermal/thermal_sysfs.c
> @@ -199,7 +199,7 @@ policy_store(struct device *dev, struct device_attribute *attr,
> char name[THERMAL_NAME_LENGTH];
> int ret;
>
> - snprintf(name, sizeof(name), "%s", buf);
> + strscpy(name, buf);
>
> ret = thermal_zone_device_set_policy(tz, name);
> if (!ret)
> --
Applied as 6.20 material, thanks!
Powered by blists - more mailing lists