lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <292183a9-deef-b8fe-c3a8-3ee39211808d@arm.com>
Date:   Wed, 9 Dec 2020 15:53:27 +0000
From:   Lukasz Luba <lukasz.luba@....com>
To:     Daniel Lezcano <daniel.lezcano@...aro.org>
Cc:     rui.zhang@...el.com, linux-kernel@...r.kernel.org,
        linux-pm@...r.kernel.org, srinivas.pandruvada@...ux.intel.com,
        kai.heng.feng@...onical.com
Subject: Re: [PATCH RFC 1/4] thermal/core: Emit a warning if the thermal zone
 is updated without ops

Hi Daniel,

On 12/9/20 3:34 PM, Daniel Lezcano wrote:
> The actual code is silently ignoring a thermal zone update when a
> driver is requesting it without a get_temp ops set.
> 
> That looks not correct, as the caller should not have called this
> function if the thermal zone is unable to read the temperature.
> 
> That makes the code less robust as the check won't detect the driver
> is inconsistently using the thermal API and that does not help to
> improve the framework as these circumvolutions hide the problem at the
> source.
> 
> In order to detect the situation when it happens, let's add a warning
> when the update is requested without the get_temp() ops set.
> 
> Any warning emitted will have to be fixed at the source of the
> problem: the caller must not call thermal_zone_device_update if there
> is not get_temp callback set.
> 
> Cc: Thara Gopinath <thara.gopinath@...aro.org>
> Cc: Amit Kucheria <amitk@...nel.org>
> Cc: linux-pm@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org
> Signed-off-by: Daniel Lezcano <daniel.lezcano@...aro.org>
> ---
>   drivers/thermal/thermal_core.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index dee40ff41177..afc02e7d1045 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -548,7 +548,8 @@ void thermal_zone_device_update(struct thermal_zone_device *tz,
>   	if (atomic_read(&in_suspend))
>   		return;
>   
> -	if (!tz->ops->get_temp)
> +	if (WARN_ONCE(!tz->ops->get_temp, "'%s' must not be called without "
> +		      "'get_temp' ops set\n", __FUNCTION__))
>   		return;
>   
>   	update_temperature(tz);
> 

With this RFC and the link that you gave me in previous thread, I see
the motivation.

I would change __FUNCTION__ into __func__, but other than that LGTM.

Reviewed-by: Lukasz Luba <lukasz.luba@....com>

Regards,
Lukasz

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ