From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.24; helo=mga09.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E6AFD2236BAB9 for ; Tue, 9 Jan 2018 21:35:08 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jan 2018 21:40:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,338,1511856000"; d="scan'208";a="193748899" Received: from ray-dev.ccr.corp.intel.com ([10.239.9.19]) by fmsmga006.fm.intel.com with ESMTP; 09 Jan 2018 21:40:19 -0800 From: Ruiyu Ni To: edk2-devel@lists.01.org Cc: Star Zeng , Eric Dong Date: Wed, 10 Jan 2018 13:40:15 +0800 Message-Id: <20180110054015.406612-3-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.15.1.windows.2 In-Reply-To: <20180110054015.406612-1-ruiyu.ni@intel.com> References: <20180110054015.406612-1-ruiyu.ni@intel.com> Subject: [PATCH 2/2] UefiCpuPkg/MtrrLib: Fix an assertion bug X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 05:35:09 -0000 0 40 f0 100 +---WT--+--UC--+--WT--+-----WB----+----UC----+ When calculating the shortest path from 0 to 100, the MtrrLibCalculateLeastMtrrs() is called to update the Vertices.Previous. When calculating the shortest path from 0 to 40, MtrrLibCalculateLeastMtrrs() is called recursively to update the Vertices.Previous. The second call corrupt the Previous value that will be used later. The patch removes the code that corrupts Previous. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Cc: Star Zeng Cc: Eric Dong --- UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 1 - 1 file changed, 1 deletion(-) diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c index 768d4d5cff..30b0df030b 100644 --- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c +++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c @@ -1171,7 +1171,6 @@ MtrrLibCalculateLeastMtrrs ( for (Index = Start; Index <= Stop; Index++) { Vertices[Index].Visited = FALSE; - Vertices[Index].Previous = VertexCount; Mandatory = Weight[M(Start,Index)]; Vertices[Index].Weight = Mandatory; if (Mandatory != MAX_WEIGHT) { -- 2.15.1.windows.2