From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932622AbcBIMYP (ORCPT ); Tue, 9 Feb 2016 07:24:15 -0500 Received: from terminus.zytor.com ([198.137.202.10]:36217 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755734AbcBIMYM (ORCPT ); Tue, 9 Feb 2016 07:24:12 -0500 Date: Tue, 9 Feb 2016 04:23:39 -0800 From: tip-bot for Borislav Petkov Message-ID: Cc: peterz@infradead.org, hpa@zytor.com, bp@suse.de, mingo@kernel.org, torvalds@linux-foundation.org, tv@lio96.de, tglx@linutronix.de, linux-kernel@vger.kernel.org Reply-To: hpa@zytor.com, peterz@infradead.org, bp@suse.de, torvalds@linux-foundation.org, tv@lio96.de, mingo@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org In-Reply-To: <1454499225-21544-11-git-send-email-bp@alien8.de> References: <1454499225-21544-11-git-send-email-bp@alien8.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/microcode] x86/microcode/intel: Move the BUG_ON up and turn it into WARN_ON Git-Commit-ID: 58b5f2cc4bdbc9b616e68639f5a84886aa5be590 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 58b5f2cc4bdbc9b616e68639f5a84886aa5be590 Gitweb: http://git.kernel.org/tip/58b5f2cc4bdbc9b616e68639f5a84886aa5be590 Author: Borislav Petkov AuthorDate: Wed, 3 Feb 2016 12:33:38 +0100 Committer: Ingo Molnar CommitDate: Tue, 9 Feb 2016 11:41:17 +0100 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 Signed-off-by: Borislav Petkov Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/1454499225-21544-11-git-send-email-bp@alien8.de Signed-off-by: Ingo Molnar --- arch/x86/kernel/cpu/microcode/intel.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index d1b2f58..c029c2b 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -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); - uci = ucode_cpu_info + cpu; - mc = uci->mc; - /* We should bind the task to the CPU */ - BUG_ON(cpu_num != cpu); + if (WARN_ON(cpu_num != cpu)) + return -1; + uci = ucode_cpu_info + cpu; + mc = uci->mc; if (!mc) return 0;