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>] [day] [month] [year] [list]
Message-ID: <1472866848-1706-1-git-send-email-Yazen.Ghannam@amd.com>
Date:   Fri, 2 Sep 2016 20:40:48 -0500
From:   Yazen Ghannam <Yazen.Ghannam@....com>
To:     <tglx@...utronix.de>, <mingo@...hat.com>, <hpa@...or.com>,
        <x86@...nel.org>
CC:     <bp@...e.de>, <linux-kernel@...r.kernel.org>,
        Yazen Ghannam <Yazen.Ghannam@....com>
Subject: [PATCH v2] x86/AMD: Fix Socket ID for LLC topology for AMD Fam17h systems

Socket ID is an unsigned value and starts at 0. Subtracting 1
from it is incorrect and the result will underflow if
socket_id=0.

Remove substraction when extracting socket_id from c->apicid.

Signed-off-by: Yazen Ghannam <Yazen.Ghannam@....com>
---
Link:
http://lkml.kernel.org/r/1472674900-60688-1-git-send-email-Yazen.Ghannam@amd.com

v1->v2:
* Don't do logical AND so as to not restrict # of sockets to 2.

 arch/x86/kernel/cpu/amd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index f3d8a92..793bc23 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -365,7 +365,7 @@ static void amd_detect_cmp(struct cpuinfo_x86 *c)
 	 if (c->x86 != 0x17 || !cpuid_edx(0x80000006))
 		return;
 
-	socket_id	= (c->apicid >> bits) - 1;
+	socket_id	= c->apicid >> bits;
 	core_complex_id	= (c->apicid & ((1 << bits) - 1)) >> 3;
 
 	per_cpu(cpu_llc_id, cpu) = (socket_id << 3) | core_complex_id;
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ