thermal: hwmon: replace deprecated strcpy() with strscpy()
PATCH 1/1 thermal: hwmon: replace deprecated strcpy() with strscpy()
strcpy() is deprecated; use strscpy() instead.
--- 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
Rafael J. Wysocki
maintainerQuoted 2 lines · Osama Abdelkader
strcpy()is deprecated; usestrscpy()instead.
So why is it better to use strscpy() in this particular case?
Quoted 21 lines
Signed-off-by Osama Abdelkader <[email protected]>--- drivers/thermal/thermal_hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/thermal/thermal_hwmon.c +1
-2@@ -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); --2.43.0
Quoted 6 lines · Rafael J. Wysocki
Quoted 2 lines · Osama Abdelkader
strcpy()is deprecated; usestrscpy()instead.So why is it better to use
strscpy()in this particular case?
Thanks for the review. Technically, there is no change since both have const buf size, it's just for consistency with other drivers.
Regards,
Osama
Quoted 22 lines
Quoted 22 lines
Signed-off-by Osama Abdelkader <[email protected]>--- drivers/thermal/thermal_hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/thermal/thermal_hwmon.c +1
-2@@ -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); --2.43.0
Rafael J. Wysocki
maintainerQuoted 11 lines · Osama Abdelkader
Quoted 6 lines · Rafael J. Wysocki
Quoted 2 lines · Osama Abdelkader
strcpy()is deprecated; usestrscpy()instead.So why is it better to use
strscpy()in this particular case?Thanks for the review. Technically, there is no change since both have const buf size, it's just for consistency with other drivers.
$ cd linux-kernel-source $ git grep strcpy | wc -l 1187
What kind of consistency do you mean?
Quoted 11 lines · Rafael J. Wysocki
Quoted 9 lines · Osama Abdelkader
Quoted 6 lines · Rafael J. Wysocki
Quoted 2 lines · Osama Abdelkader
strcpy()is deprecated; usestrscpy()instead.So why is it better to use
strscpy()in this particular case?
Quoted 8 lines
Quoted 2 lines
Thanks for the review. Technically, there is no change since both have const buf size, it's just for consistency with other drivers.
$ cd linux-kernel-source $ git grep strcpy | wc -l 1187What kind of consistency do you mean?
I mean in thermal subsystem, it's only this one.
Rafael J. Wysocki
maintainerQuoted 16 lines · Osama Abdelkader
Quoted 14 lines · Rafael J. Wysocki
Quoted 11 lines · Osama Abdelkader
Quoted 6 lines · Rafael J. Wysocki
Quoted 2 lines · Osama Abdelkader
strcpy()is deprecated; usestrscpy()instead.So why is it better to use
strscpy()in this particular case?Thanks for the review. Technically, there is no change since both have const buf size, it's just for consistency with other drivers.
Quoted 7 lines
Quoted 5 lines
$ cd linux-kernel-source $ git grep strcpy | wc -l 1187What kind of consistency do you mean?
I mean in thermal subsystem, it's only this one.
So please add this information to the patch changelog.
Quoted 22 lines · Rafael J. Wysocki
Quoted 20 lines · Osama Abdelkader
Quoted 18 lines · Rafael J. Wysocki
Quoted 11 lines · Osama Abdelkader
Quoted 6 lines · Rafael J. Wysocki
Quoted 2 lines · Osama Abdelkader
strcpy()is deprecated; usestrscpy()instead.So why is it better to use
strscpy()in this particular case?Thanks for the review. Technically, there is no change since both have const buf size, it's just for consistency with other drivers.
$ cd linux-kernel-source $ git grep strcpy | wc -l 1187
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
What kind of consistency do you mean?
I mean in thermal subsystem, it's only this one.
So please add this information to the patch changelog.
Sure, I just sent v2.
Thanks,
Osama