thermal: hwmon: replace deprecated strcpy() with strscpy()
PATCH v2 1/1 thermal: hwmon: replace deprecated strcpy() with strscpy()
strcpy() is deprecated, use strscpy() instead for consistency with thermal subsystem since this is the only strcpy there.
---
v2:
Improve the commit msg: add that this is the only strcpy left in thermal subsystem
--- drivers/thermal/thermal_hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/thermal_hwmon.c +1 -1
@@ -96,7 +96,7 @@ thermal_hwmon_lookup_by_type(const struct thermal_zone_device *tz)mutex_lock (&thermal_hwmon_list_lock);list_for_each_entry (hwmon, &thermal_hwmon_list, node) { -strcpy (type, tz->type); +strscpy (type, tz->type);strreplace (type,'-' ,'_' );if (!strcmp (hwmon->type, type)) {mutex_unlock (&thermal_hwmon_list_lock);
Signature · 1 line
2.43.0
Quoted 16 lines · Osama Abdelkader
strcpy()is deprecated, usestrscpy()instead for consistency with thermal subsystem since this is the only strcpy there.Signed-off-by Osama Abdelkader <[email protected]>---
v2:
Improve the commit msg: add that this is the only strcpy left in thermal subsystem--- drivers/thermal/thermal_hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/thermal/thermal_hwmon.c +0
-0
drivers/thermal/thermal_hwmon.c thermal_hwmon_lookup_by_type(const struct thermal_zone_device *tz) · line 102
Quoted 8 lines
drivers/thermal/thermal_hwmon.c +1
-1@@ -96,7 +96,7 @@ thermal_hwmon_lookup_by_type(const struct thermal_zone_device *tz)mutex_lock (&thermal_hwmon_list_lock);list_for_each_entry (hwmon, &thermal_hwmon_list, node) { -strcpy (type, tz->type); +strscpy (type, tz->type);strreplace (type,'-' ,'_' );if (!strcmp (hwmon->type, type)) {mutex_unlock (&thermal_hwmon_list_lock);
LGTM, that was indeed the single occurrence in thermal sub-system. Thanks!
Quoted 33 lines · Lukasz Luba
Quoted 16 lines · Osama Abdelkader
strcpy()is deprecated, usestrscpy()instead for consistency with thermal subsystem since this is the only strcpy there.Signed-off-by Osama Abdelkader <[email protected]>---
v2:
Improve the commit msg: add that this is the only strcpy left in thermal subsystem--- drivers/thermal/thermal_hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/thermal/thermal_hwmon.c +0
-0drivers/thermal/thermal_hwmon.c thermal_hwmon_lookup_by_type(const struct thermal_zone_device *tz) · line 102
Quoted 8 lines
drivers/thermal/thermal_hwmon.c +1
-1@@ -96,7 +96,7 @@ thermal_hwmon_lookup_by_type(const struct thermal_zone_device *tz)mutex_lock (&thermal_hwmon_list_lock);list_for_each_entry (hwmon, &thermal_hwmon_list, node) { -strcpy (type, tz->type); +strscpy (type, tz->type);strreplace (type,'-' ,'_' );if (!strcmp (hwmon->type, type)) {mutex_unlock (&thermal_hwmon_list_lock);LGTM, that was indeed the single occurrence in thermal sub-system. Thanks!
Quoted 1 line
Reviewed-by Lukasz Luba <[email protected]>
Applied as 6.18 material, thanks!