thermal: sysfs: Replace snprintf with strscpy in policy_store
PATCH 1/1 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 <[email protected]>
--- drivers/thermal/thermal_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/thermal_sysfs.c +1 -1
@@ -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)
Signature · 2 lines
Thorsten Blum <[email protected]> GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
Quoted 14 lines · Thorsten Blum
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 <[email protected]>--- drivers/thermal/thermal_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/thermal/thermal_sysfs.c +0
-0
drivers/thermal/thermal_sysfs.c policy_store(struct device *dev, struct device_attribute *attr,
Quoted 9 lines
drivers/thermal/thermal_sysfs.c +1
-2@@ -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!