From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753199AbbEKISQ (ORCPT ); Mon, 11 May 2015 04:18:16 -0400 Received: from mail.skyhub.de ([78.46.96.112]:55972 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752457AbbEKIQB (ORCPT ); Mon, 11 May 2015 04:16:01 -0400 From: Borislav Petkov To: Ingo Molnar Cc: LKML Subject: [PATCH 3/5] x86/MTRR: Remove wrong address check in __mtrr_type_lookup() Date: Mon, 11 May 2015 10:15:52 +0200 Message-Id: <1431332153-18566-8-git-send-email-bp@alien8.de> X-Mailer: git-send-email 2.3.5 In-Reply-To: <1431332153-18566-1-git-send-email-bp@alien8.de> References: <1431332153-18566-1-git-send-email-bp@alien8.de> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Toshi Kani __mtrr_type_lookup() checks MTRR fixed ranges when mtrr_state.have_fixed is set and start is less than 0x100000. However, the 'else if (start < 0x1000000)' in the code checks with a wrong address as it has an extra-zero in the address. The code still runs correctly as this check is meaningless, though. This patch replaces the wrong address check with 'else' with no condition. Signed-off-by: Toshi Kani Cc: linux-mm Cc: x86-ml Cc: dave.hansen@intel.com Cc: Elliott@hp.com Cc: pebolle@tiscali.nl Cc: Andrew Morton Cc: H. Peter Anvin Cc: Thomas Gleixner Cc: mingo@redhat.com Link: http://lkml.kernel.org/r/1427234921-19737-4-git-send-email-toshi.kani@hp.com Signed-off-by: Borislav Petkov --- arch/x86/kernel/cpu/mtrr/generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c index 7d74f7b3c6ba..5b239679cfc9 100644 --- a/arch/x86/kernel/cpu/mtrr/generic.c +++ b/arch/x86/kernel/cpu/mtrr/generic.c @@ -137,7 +137,7 @@ static u8 __mtrr_type_lookup(u64 start, u64 end, u64 *partial_end, int *repeat) idx = 1 * 8; idx += ((start - 0x80000) >> 14); return mtrr_state.fixed_ranges[idx]; - } else if (start < 0x1000000) { + } else { idx = 3 * 8; idx += ((start - 0xC0000) >> 12); return mtrr_state.fixed_ranges[idx]; -- 2.3.5