[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0hrKBNxDeZOKpUXyuZV7LRUX4ov4ifEGDtNMrA8km6uOA@mail.gmail.com>
Date: Wed, 3 Sep 2025 13:50:03 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Osama Abdelkader <osama.abdelkader@...il.com>
Cc: rafael@...nel.org, daniel.lezcano@...aro.org, rui.zhang@...el.com,
lukasz.luba@....com, linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] thermal: hwmon: replace deprecated strcpy() with strscpy()
On Mon, Sep 1, 2025 at 5:06 PM Osama Abdelkader
<osama.abdelkader@...il.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@...il.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
>
Powered by blists - more mailing lists