x86/microcode/intel: Move the BUG_ON up and turn it into WARN_ON

If we're going to BUG_ON() because we're running on the wrong CPU, we
better do it as the first thing we do when entering that function. And
also, turn it into a WARN_ON() because it is not worth to panic the
system if we apply the microcode on the wrong CPU - we're simply going
to exit early.

Tested-by: Thomas Voegtle <tv@lio96.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1454499225-21544-11-git-send-email-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
Borislav Petkov 2016-02-03 12:33:38 +01:00 committed by Ingo Molnar
parent de778275c2
commit 58b5f2cc4b
1 changed files with 4 additions and 4 deletions

View File

@ -843,12 +843,12 @@ static int apply_microcode_intel(int cpu)
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))
return -1;
uci = ucode_cpu_info + cpu;
mc = uci->mc;
/* We should bind the task to the CPU */
BUG_ON(cpu_num != cpu);
if (!mc)
return 0;