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  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]
Date:   Fri, 14 Jun 2019 12:11:14 +0200
From:   Daniel Lezcano <daniel.lezcano@...aro.org>
To:     Nathan Huckleberry <nhuck@...gle.com>, miquel.raynal@...tlin.com,
        rui.zhang@...el.com, edubezval@...il.com
Cc:     linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        clang-built-linux@...glegroups.com
Subject: Re: [PATCH] thermal: armada: Fix -Wshift-negative-value

On 13/06/2019 20:49, Nathan Huckleberry wrote:
> Clang produces the following warning
> 
> drivers/thermal/armada_thermal.c:270:33: warning: shifting a negative
> signed value is undefined [-Wshift-negative-value]
> 1 warning        reg &= ~CONTROL1_TSEN_AVG_MASK <<
> CONTROL1_TSEN_AVG_SHIFT; generated
> .
>                ~~~~~~~~~~~~~~~~~~~~~~~ ^
> 
> CONTROL1_TSEN_AVG_SHIFT is defined to be zero.
> Since shifting by zero does nothing this variable can be removed.
> 
> Cc: clang-built-linux@...glegroups.com
> Link: https://github.com/ClangBuiltLinux/linux/issues/532
> Signed-off-by: Nathan Huckleberry <nhuck@...gle.com>

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

> ---
>  drivers/thermal/armada_thermal.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
> index 8c07a393dc2e..709a22f455e9 100644
> --- a/drivers/thermal/armada_thermal.c
> +++ b/drivers/thermal/armada_thermal.c
> @@ -53,7 +53,6 @@
>  #define CONTROL0_TSEN_MODE_EXTERNAL	0x2
>  #define CONTROL0_TSEN_MODE_MASK		0x3
>  
> -#define CONTROL1_TSEN_AVG_SHIFT		0
>  #define CONTROL1_TSEN_AVG_MASK		0x7
>  #define CONTROL1_EXT_TSEN_SW_RESET	BIT(7)
>  #define CONTROL1_EXT_TSEN_HW_RESETn	BIT(8)
> @@ -267,8 +266,8 @@ static void armada_cp110_init(struct platform_device *pdev,
>  
>  	/* Average the output value over 2^1 = 2 samples */
>  	regmap_read(priv->syscon, data->syscon_control1_off, &reg);
> -	reg &= ~CONTROL1_TSEN_AVG_MASK << CONTROL1_TSEN_AVG_SHIFT;
> -	reg |= 1 << CONTROL1_TSEN_AVG_SHIFT;
> +	reg &= ~CONTROL1_TSEN_AVG_MASK;
> +	reg |= 1;
>  	regmap_write(priv->syscon, data->syscon_control1_off, reg);
>  }
>  
> 


-- 
 <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