commit 56a159efebc0 Author: Christian Kujau Date: Fri Feb 3 17:13:33 2023 +0100 MTRR_TYPE_INVALID fixes as proposed by Linus. diff --git a/arch/x86/include/asm/mtrr.h b/arch/x86/include/asm/mtrr.h index f0eeaf6e5f5f..38ded2762847 100644 --- a/arch/x86/include/asm/mtrr.h +++ b/arch/x86/include/asm/mtrr.h @@ -53,7 +53,8 @@ static inline u8 mtrr_type_lookup(u64 addr, u64 end, u8 *uniform) /* * Return no-MTRRs: */ - return MTRR_TYPE_INVALID; + *uniform = 1; + return MTRR_TYPE_INVALID; /* ??? */ } #define mtrr_save_fixed_ranges(arg) do {} while (0) #define mtrr_save_state() do {} while (0) diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c index ee09d359e08f..0d77998b90ea 100644 --- a/arch/x86/kernel/cpu/mtrr/generic.c +++ b/arch/x86/kernel/cpu/mtrr/generic.c @@ -261,11 +261,13 @@ u8 mtrr_type_lookup(u64 start, u64 end, u8 *uniform) /* Make end inclusive instead of exclusive */ end--; + type = MTRR_TYPE_INVALID; /* ??? */ if (!mtrr_state_set) - return MTRR_TYPE_INVALID; + goto out; + type = mtrr_state.def_type; if (!(mtrr_state.enabled & MTRR_STATE_MTRR_ENABLED)) - return MTRR_TYPE_INVALID; + goto out; /* * Look up the fixed ranges first, which take priority over