From patchwork Mon Jan 14 17:47:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 1024725 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43dgsD5Rr8z9sCh; Tue, 15 Jan 2019 04:47:11 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1gj6KI-0007ih-M1; Mon, 14 Jan 2019 17:47:06 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1gj6KG-0007gy-GP for fwts-devel@lists.ubuntu.com; Mon, 14 Jan 2019 17:47:04 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1gj6KG-0003mU-6W; Mon, 14 Jan 2019 17:47:04 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] mtrr: fix incorrect mask on amd_sys_conf Date: Mon, 14 Jan 2019 17:47:03 +0000 Message-Id: <20190114174703.17844-1-colin.king@canonical.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King 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 Acked-by: Alex Hung Acked-by: Ivan Hu --- 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; }