* [PATCH] thermal: hwmon: replace deprecated strcpy() with strscpy()
@ 2025-09-01 15:06 Osama Abdelkader
2025-09-03 11:50 ` Rafael J. Wysocki
0 siblings, 1 reply; 7+ messages in thread
From: Osama Abdelkader @ 2025-09-01 15:06 UTC (permalink / raw)
To: rafael, daniel.lezcano, rui.zhang, lukasz.luba
Cc: linux-pm, linux-kernel, Osama Abdelkader
strcpy() is deprecated; use strscpy() instead.
Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
---
drivers/thermal/thermal_hwmon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
index 0ecccd4d8556..64cc3ab949fe 100644
--- a/drivers/thermal/thermal_hwmon.c
+++ b/drivers/thermal/thermal_hwmon.c
@@ -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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] thermal: hwmon: replace deprecated strcpy() with strscpy()
2025-09-01 15:06 [PATCH] thermal: hwmon: replace deprecated strcpy() with strscpy() Osama Abdelkader
@ 2025-09-03 11:50 ` Rafael J. Wysocki
2025-09-03 14:04 ` Osama Abdelkader
0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2025-09-03 11:50 UTC (permalink / raw)
To: Osama Abdelkader
Cc: rafael, daniel.lezcano, rui.zhang, lukasz.luba, linux-pm,
linux-kernel
On Mon, Sep 1, 2025 at 5:06 PM Osama Abdelkader
<osama.abdelkader@gmail.com> wrote:
>
> strcpy() is deprecated; use strscpy() instead.
So why is it better to use strscpy() in this particular case?
> Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
> ---
> drivers/thermal/thermal_hwmon.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
> index 0ecccd4d8556..64cc3ab949fe 100644
> --- a/drivers/thermal/thermal_hwmon.c
> +++ b/drivers/thermal/thermal_hwmon.c
> @@ -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
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] thermal: hwmon: replace deprecated strcpy() with strscpy()
2025-09-03 11:50 ` Rafael J. Wysocki
@ 2025-09-03 14:04 ` Osama Abdelkader
2025-09-03 14:21 ` Rafael J. Wysocki
0 siblings, 1 reply; 7+ messages in thread
From: Osama Abdelkader @ 2025-09-03 14:04 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: daniel.lezcano, rui.zhang, lukasz.luba, linux-pm, linux-kernel
On Wed, Sep 03, 2025 at 01:50:03PM +0200, Rafael J. Wysocki wrote:
> On Mon, Sep 1, 2025 at 5:06 PM Osama Abdelkader
> <osama.abdelkader@gmail.com> wrote:
> >
> > strcpy() is deprecated; use strscpy() 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
>
> > Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
> > ---
> > drivers/thermal/thermal_hwmon.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
> > index 0ecccd4d8556..64cc3ab949fe 100644
> > --- a/drivers/thermal/thermal_hwmon.c
> > +++ b/drivers/thermal/thermal_hwmon.c
> > @@ -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
> >
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] thermal: hwmon: replace deprecated strcpy() with strscpy()
2025-09-03 14:04 ` Osama Abdelkader
@ 2025-09-03 14:21 ` Rafael J. Wysocki
2025-09-03 17:28 ` Osama Abdelkader
0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2025-09-03 14:21 UTC (permalink / raw)
To: Osama Abdelkader
Cc: Rafael J. Wysocki, daniel.lezcano, rui.zhang, lukasz.luba,
linux-pm, linux-kernel
On Wed, Sep 3, 2025 at 4:04 PM Osama Abdelkader
<osama.abdelkader@gmail.com> wrote:
>
> On Wed, Sep 03, 2025 at 01:50:03PM +0200, Rafael J. Wysocki wrote:
> > On Mon, Sep 1, 2025 at 5:06 PM Osama Abdelkader
> > <osama.abdelkader@gmail.com> wrote:
> > >
> > > strcpy() is deprecated; use strscpy() 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?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] thermal: hwmon: replace deprecated strcpy() with strscpy()
2025-09-03 14:21 ` Rafael J. Wysocki
@ 2025-09-03 17:28 ` Osama Abdelkader
2025-09-03 18:36 ` Rafael J. Wysocki
0 siblings, 1 reply; 7+ messages in thread
From: Osama Abdelkader @ 2025-09-03 17:28 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: daniel.lezcano, rui.zhang, lukasz.luba, linux-pm, linux-kernel
On Wed, Sep 03, 2025 at 04:21:35PM +0200, Rafael J. Wysocki wrote:
> On Wed, Sep 3, 2025 at 4:04 PM Osama Abdelkader
> <osama.abdelkader@gmail.com> wrote:
> >
> > On Wed, Sep 03, 2025 at 01:50:03PM +0200, Rafael J. Wysocki wrote:
> > > On Mon, Sep 1, 2025 at 5:06 PM Osama Abdelkader
> > > <osama.abdelkader@gmail.com> wrote:
> > > >
> > > > strcpy() is deprecated; use strscpy() 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?
I mean in thermal subsystem, it's only this one.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] thermal: hwmon: replace deprecated strcpy() with strscpy()
2025-09-03 17:28 ` Osama Abdelkader
@ 2025-09-03 18:36 ` Rafael J. Wysocki
2025-09-03 19:22 ` Osama Abdelkader
0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2025-09-03 18:36 UTC (permalink / raw)
To: Osama Abdelkader
Cc: Rafael J. Wysocki, daniel.lezcano, rui.zhang, lukasz.luba,
linux-pm, linux-kernel
On Wed, Sep 3, 2025 at 7:29 PM Osama Abdelkader
<osama.abdelkader@gmail.com> wrote:
>
> On Wed, Sep 03, 2025 at 04:21:35PM +0200, Rafael J. Wysocki wrote:
> > On Wed, Sep 3, 2025 at 4:04 PM Osama Abdelkader
> > <osama.abdelkader@gmail.com> wrote:
> > >
> > > On Wed, Sep 03, 2025 at 01:50:03PM +0200, Rafael J. Wysocki wrote:
> > > > On Mon, Sep 1, 2025 at 5:06 PM Osama Abdelkader
> > > > <osama.abdelkader@gmail.com> wrote:
> > > > >
> > > > > strcpy() is deprecated; use strscpy() 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?
>
> I mean in thermal subsystem, it's only this one.
So please add this information to the patch changelog.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] thermal: hwmon: replace deprecated strcpy() with strscpy()
2025-09-03 18:36 ` Rafael J. Wysocki
@ 2025-09-03 19:22 ` Osama Abdelkader
0 siblings, 0 replies; 7+ messages in thread
From: Osama Abdelkader @ 2025-09-03 19:22 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: daniel.lezcano, rui.zhang, lukasz.luba, linux-pm, linux-kernel
On Wed, Sep 03, 2025 at 08:36:19PM +0200, Rafael J. Wysocki wrote:
> On Wed, Sep 3, 2025 at 7:29 PM Osama Abdelkader
> <osama.abdelkader@gmail.com> wrote:
> >
> > On Wed, Sep 03, 2025 at 04:21:35PM +0200, Rafael J. Wysocki wrote:
> > > On Wed, Sep 3, 2025 at 4:04 PM Osama Abdelkader
> > > <osama.abdelkader@gmail.com> wrote:
> > > >
> > > > On Wed, Sep 03, 2025 at 01:50:03PM +0200, Rafael J. Wysocki wrote:
> > > > > On Mon, Sep 1, 2025 at 5:06 PM Osama Abdelkader
> > > > > <osama.abdelkader@gmail.com> wrote:
> > > > > >
> > > > > > strcpy() is deprecated; use strscpy() 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?
> >
> > 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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-09-03 19:22 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-01 15:06 [PATCH] thermal: hwmon: replace deprecated strcpy() with strscpy() Osama Abdelkader
2025-09-03 11:50 ` Rafael J. Wysocki
2025-09-03 14:04 ` Osama Abdelkader
2025-09-03 14:21 ` Rafael J. Wysocki
2025-09-03 17:28 ` Osama Abdelkader
2025-09-03 18:36 ` Rafael J. Wysocki
2025-09-03 19:22 ` Osama Abdelkader
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).