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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160114054823.GB4638@hr-amur2>
Date:	Thu, 14 Jan 2016 13:48:24 +0800
From:	Huang Rui <ray.huang@....com>
To:	Dan Carpenter <dan.carpenter@...cle.com>
CC:	Thomas Gleixner <tglx@...utronix.de>,
	Yinghai Lu <yhlu.kernel@...il.com>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, <x86@...nel.org>,
	Borislav Petkov <bp@...e.de>,
	Aravind Gopalakrishnan <Aravind.Gopalakrishnan@....com>,
	Andy Lutomirski <luto@...nel.org>,
	"Hector Marco-Gisbert" <hecmargi@....es>,
	<linux-kernel@...r.kernel.org>, <kernel-janitors@...r.kernel.org>
Subject: Re: [patch] x86/AMD: remove an unneeded condition in
 srat_detect_node()

On Wed, Jan 13, 2016 at 03:39:40PM +0300, Dan Carpenter wrote:
> Originally we calculated ht_nodeid as "ht_nodeid = apicid - boot_cpu_id;"
> so presumably it could be negative.  But after commit 01aaea1afbcd
> ('x86: introduce initial apicid') we use c->initial_apicid which is an
> unsigned short and thus always >= 0.
> 
> It causes a static checker warning to test for impossible conditions so
> let's remove it.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
> 

Looks OK for me.

Reviewed-by: Huang Rui <ray.huang@....com>

> diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
> index e678dde..a07956a 100644
> --- a/arch/x86/kernel/cpu/amd.c
> +++ b/arch/x86/kernel/cpu/amd.c
> @@ -434,8 +434,7 @@ static void srat_detect_node(struct cpuinfo_x86 *c)
>  		 */
>  		int ht_nodeid = c->initial_apicid;
>  
> -		if (ht_nodeid >= 0 &&
> -		    __apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
> +		if (__apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
>  			node = __apicid_to_node[ht_nodeid];
>  		/* Pick a nearby node */
>  		if (!node_online(node))

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ