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: <1454499225-21544-12-git-send-email-bp@alien8.de>
Date:	Wed,  3 Feb 2016 12:33:39 +0100
From:	Borislav Petkov <bp@...en8.de>
To:	X86 ML <x86@...nel.org>
Cc:	LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH 11/17] x86/microcode/intel: Cleanup apply_microcode_intel()

From: Borislav Petkov <bp@...e.de>

Get rid of local variable cpu_num as it is equal to @cpu now. Deref
cpu_data() only when it is really needed at the end.

No functionality change.

Signed-off-by: Borislav Petkov <bp@...e.de>
---
 arch/x86/kernel/cpu/microcode/intel.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c
index c029c2bb2a29..35186a0dd5fc 100644
--- a/arch/x86/kernel/cpu/microcode/intel.c
+++ b/arch/x86/kernel/cpu/microcode/intel.c
@@ -839,12 +839,11 @@ static int apply_microcode_intel(int cpu)
 {
 	struct microcode_intel *mc;
 	struct ucode_cpu_info *uci;
+	struct cpuinfo_x86 *c;
 	unsigned int val[2];
-	int cpu_num = raw_smp_processor_id();
-	struct cpuinfo_x86 *c = &cpu_data(cpu_num);
 
 	/* We should bind the task to the CPU */
-	if (WARN_ON(cpu_num != cpu))
+	if (WARN_ON(raw_smp_processor_id() != cpu))
 		return -1;
 
 	uci = ucode_cpu_info + cpu;
@@ -874,15 +873,18 @@ static int apply_microcode_intel(int cpu)
 
 	if (val[1] != mc->hdr.rev) {
 		pr_err("CPU%d update to revision 0x%x failed\n",
-		       cpu_num, mc->hdr.rev);
+		       cpu, mc->hdr.rev);
 		return -1;
 	}
+
 	pr_info("CPU%d updated to revision 0x%x, date = %04x-%02x-%02x\n",
-		cpu_num, val[1],
+		cpu, val[1],
 		mc->hdr.date & 0xffff,
 		mc->hdr.date >> 24,
 		(mc->hdr.date >> 16) & 0xff);
 
+	c = &cpu_data(cpu);
+
 	uci->cpu_sig.rev = val[1];
 	c->microcode = val[1];
 
-- 
2.3.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ