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]
Date:   Mon, 24 Jun 2019 14:57:29 +0100
From:   Russell King - ARM Linux admin <linux@...linux.org.uk>
To:     Phong Tran <tranmanphong@...il.com>
Cc:     acme@...nel.org, alexander.shishkin@...ux.intel.com,
        alexander.sverdlin@...il.com, allison@...utok.net, andrew@...n.ch,
        ast@...nel.org, bgolaszewski@...libre.com, bpf@...r.kernel.org,
        daniel@...earbox.net, daniel@...que.org, dmg@...ingmachine.org,
        festevam@...il.com, gerg@...inux.org, gregkh@...uxfoundation.org,
        gregory.clement@...tlin.com, haojian.zhuang@...il.com,
        hsweeten@...ionengravers.com, illusionist.neo@...il.com,
        info@...ux.net, jason@...edaemon.net, jolsa@...hat.com,
        kafai@...com, kernel@...gutronix.de, kgene@...nel.org,
        krzk@...nel.org, kstewart@...uxfoundation.org,
        linux-arm-kernel@...ts.infradead.org, linux-imx@....com,
        linux-kernel@...r.kernel.org, linux-omap@...r.kernel.org,
        linux-samsung-soc@...r.kernel.org, liviu.dudau@....com,
        lkundrak@...sk, lorenzo.pieralisi@....com, mark.rutland@....com,
        mingo@...hat.com, namhyung@...nel.org, netdev@...r.kernel.org,
        nsekhar@...com, peterz@...radead.org, robert.jarzmik@...e.fr,
        s.hauer@...gutronix.de, sebastian.hesselbarth@...il.com,
        shawnguo@...nel.org, songliubraving@...com, sudeep.holla@....com,
        swinslow@...il.com, tglx@...utronix.de, tony@...mide.com,
        will@...nel.org, yhs@...com
Subject: Re: [PATCH V2 12/15] ARM: vexpress: cleanup cppcheck shifting error

On Mon, Jun 24, 2019 at 08:51:02PM +0700, Phong Tran wrote:
> [arch/arm/mach-vexpress/spc.c:366]: (error) Shifting signed 32-bit value
> by 31 bits is undefined behaviour
> 
> Signed-off-by: Phong Tran <tranmanphong@...il.com>
> ---
>  arch/arm/mach-vexpress/spc.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/mach-vexpress/spc.c b/arch/arm/mach-vexpress/spc.c
> index 0f5381d13494..425ce633667a 100644
> --- a/arch/arm/mach-vexpress/spc.c
> +++ b/arch/arm/mach-vexpress/spc.c
> @@ -57,8 +57,8 @@
>  
>  /* SPC CPU/cluster reset statue */
>  #define STANDBYWFI_STAT		0x3c
> -#define STANDBYWFI_STAT_A15_CPU_MASK(cpu)	(1 << (cpu))
> -#define STANDBYWFI_STAT_A7_CPU_MASK(cpu)	(1 << (3 + (cpu)))
> +#define STANDBYWFI_STAT_A15_CPU_MASK(cpu)	BIT((cpu))
> +#define STANDBYWFI_STAT_A7_CPU_MASK(cpu)	BIT((3 + (cpu)))

I guess you did this using a script, however, in the above two cases,
you don't need the extra parens - it was necessary in the original
though.

>  
>  /* SPC system config interface registers */
>  #define SYSCFG_WDATA		0x70
> @@ -69,7 +69,7 @@
>  #define A7_PERFVAL_BASE		0xC30
>  
>  /* Config interface control bits */
> -#define SYSCFG_START		(1 << 31)
> +#define SYSCFG_START		BIT(31)
>  #define SYSCFG_SCC		(6 << 20)
>  #define SYSCFG_STAT		(14 << 20)
>  
> @@ -90,8 +90,8 @@
>  #define CA15_DVFS	0
>  #define CA7_DVFS	1
>  #define SPC_SYS_CFG	2
> -#define STAT_COMPLETE(type)	((1 << 0) << (type << 2))
> -#define STAT_ERR(type)		((1 << 1) << (type << 2))
> +#define STAT_COMPLETE(type)	(BIT(0) << (type << 2))
> +#define STAT_ERR(type)		(BIT(1) << (type << 2))
>  #define RESPONSE_MASK(type)	(STAT_COMPLETE(type) | STAT_ERR(type))
>  
>  struct ve_spc_opp {
> @@ -162,7 +162,7 @@ void ve_spc_cpu_wakeup_irq(u32 cluster, u32 cpu, bool set)
>  	if (cluster >= MAX_CLUSTERS)
>  		return;
>  
> -	mask = 1 << cpu;
> +	mask = BIT(cpu);
>  
>  	if (!cluster_is_a15(cluster))
>  		mask <<= 4;
> -- 
> 2.11.0
> 
> 

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ