]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
thermal: sysfs: Replace snprintf() with strscpy() in policy_store()
authorThorsten Blum <thorsten.blum@linux.dev>
Mon, 12 Jan 2026 17:49:00 +0000 (18:49 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 15 Jan 2026 20:08:42 +0000 (21:08 +0100)
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>
[ rjw: Subject and changelog tweaks ]
Link: https://patch.msgid.link/20260112174901.767434-1-thorsten.blum@linux.dev
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/thermal/thermal_sysfs.c

index 26b8b340fbe659defc2c2a1f117c2a7cf91d6a47..2538c2dcf6a9ea55c547654f0951f5f36aef6a92 100644 (file)
@@ -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)