Skip to content

Commit 1ccc3be

Browse files
tobluxrafaeljw
authored andcommitted
thermal: sysfs: Replace snprintf() with strscpy() in policy_store()
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>
1 parent c116cab commit 1ccc3be

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/thermal/thermal_sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ policy_store(struct device *dev, struct device_attribute *attr,
199199
char name[THERMAL_NAME_LENGTH];
200200
int ret;
201201

202-
snprintf(name, sizeof(name), "%s", buf);
202+
strscpy(name, buf);
203203

204204
ret = thermal_zone_device_set_policy(tz, name);
205205
if (!ret)

0 commit comments

Comments
 (0)