[PATCH] mtrr: fix incorrect mask on amd_sys_conf

Colin King colin.king at canonical.com
Mon Jan 14 17:47:03 UTC 2019


From: Colin Ian King <colin.king at canonical.com>

Currently the check (amd_sys_conf | 0x200000) is always true as or'ing
anything with a non-zero leads to a non-zero (true) result. Fix this by
using an 'and' to perform the masking as was intended.

Fixes: 9e3c4bfc050d ("mtrr: check memory type above 4GB on AMD platforms")
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/bios/mtrr/mtrr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bios/mtrr/mtrr.c b/src/bios/mtrr/mtrr.c
index 453dc57b..b2576bf0 100644
--- a/src/bios/mtrr/mtrr.c
+++ b/src/bios/mtrr/mtrr.c
@@ -193,7 +193,7 @@ static int get_default_mtrr(fwts_framework *fw)
 	 */
 	if (strstr(fwts_cpuinfo->vendor_id, "AMD")) {
 		if (fwts_cpu_readmsr(fw, 0, AMD_SYS_CFG_MSR, &amd_sys_conf) == FWTS_OK)
-			if (amd_sys_conf | 0x200000)
+			if (amd_sys_conf & 0x200000)
 				amd_Tom2ForceMemTypeWB = true;
 	}
 
-- 
2.19.1




More information about the fwts-devel mailing list