From: Ruiyu Ni Date: Tue, 9 Jan 2018 10:25:20 +0000 (+0800) Subject: UefiCpuPkg/MtrrLib: Fix an assertion bug X-Git-Tag: edk2-stable201903~2632 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=0e8a782922c028cd04454a99d631e082c2153695 UefiCpuPkg/MtrrLib: Fix an assertion bug 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 Reviewed-by: Eric Dong --- 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) {