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: <6c07ec86-297f-01e0-f150-1b03c0a27c62@linaro.org>
Date:   Tue, 16 Apr 2019 19:11:00 +0200
From:   Daniel Lezcano <daniel.lezcano@...aro.org>
To:     Andrey Smirnov <andrew.smirnov@...il.com>, linux-pm@...r.kernel.org
Cc:     Chris Healy <cphealy@...il.com>,
        Lucas Stach <l.stach@...gutronix.de>,
        Eduardo Valentin <edubezval@...il.com>,
        Angus Ainslie <angus@...ea.ca>, linux-imx@....com,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 10/12] thermal: qoriq: Do not report invalid
 temperature reading

On 13/04/2019 10:27, Andrey Smirnov wrote:
> Before returning measured temperature data to upper layer we need to
> make sure that the reading was marked as "valid" to avoid reporting
> bogus data.
> 
> Signed-off-by: Andrey Smirnov <andrew.smirnov@...il.com>
> Cc: Chris Healy <cphealy@...il.com>
> Cc: Lucas Stach <l.stach@...gutronix.de>
> Cc: Eduardo Valentin <edubezval@...il.com>
> Cc: Daniel Lezcano <daniel.lezcano@...aro.org>
> Cc: Angus Ainslie (Purism) <angus@...ea.ca>
> Cc: linux-imx@....com
> Cc: linux-pm@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org
> ---

Reviewed-by: Daniel Lezcano <daniel.lezcano@...aro.org>


>  drivers/thermal/qoriq_thermal.c | 20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
> index abbbfe88422e..5c459a9d0db3 100644
> --- a/drivers/thermal/qoriq_thermal.c
> +++ b/drivers/thermal/qoriq_thermal.c
> @@ -37,6 +37,7 @@
>  #define REGS_TRITSR(n)	(0x100 + 16 * (n)) /* Immediate Temperature
>  					    * Site Register
>  					    */
> +#define TRITSR_V	BIT(31)
>  #define REGS_TTRnCR(n)	(0xf10 + 4 * (n)) /* Temperature Range n
>  					   * Control Register
>  					   */
> @@ -48,10 +49,25 @@ static int tmu_get_temp(int id, void *p, int *temp)
>  {
>  	struct qoriq_tmu_data *qdata = p;
>  	u32 val;
> +	/*
> +	 * REGS_TRITSR(id) has the following layout:
> +	 *
> +	 * 31  ... 7 6 5 4 3 2 1 0
> +	 *  V          TEMP
> +	 *
> +	 * Where V bit signifies if the measurement is ready and is
> +	 * within sensor range. TEMP is an 8 bit value representing
> +	 * temperature in C.
> +	 */
> +	if (regmap_read_poll_timeout(qdata->regmap,
> +				     REGS_TRITSR(id),
> +				     val,
> +				     val & TRITSR_V,
> +				     USEC_PER_MSEC,
> +				     10 * USEC_PER_MSEC))
> +		return -ENODATA;
>  
> -	regmap_read(qdata->regmap, REGS_TRITSR(id), &val);
>  	*temp = (val & 0xff) * 1000;
> -
>  	return 0;
>  }
>  
> 


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ