* [PATCH] thermal: sysfs: Replace snprintf with strscpy in policy_store
@ 2026-01-12 17:49 Thorsten Blum
2026-01-15 20:09 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-01-12 17:49 UTC (permalink / raw)
To: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba
Cc: Thorsten Blum, linux-pm, linux-kernel
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@linux.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)
--
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] thermal: sysfs: Replace snprintf with strscpy in policy_store
2026-01-12 17:49 [PATCH] thermal: sysfs: Replace snprintf with strscpy in policy_store Thorsten Blum
@ 2026-01-15 20:09 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2026-01-15 20:09 UTC (permalink / raw)
To: Thorsten Blum
Cc: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
linux-pm, linux-kernel
On Mon, Jan 12, 2026 at 6:49 PM Thorsten Blum <thorsten.blum@linux.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@linux.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!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-01-15 20:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-12 17:49 [PATCH] thermal: sysfs: Replace snprintf with strscpy in policy_store Thorsten Blum
2026-01-15 20:09 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox