UefiCpuPkg/MtrrLib: Fix an assertion bug
authorRuiyu Ni <ruiyu.ni@intel.com>
Tue, 9 Jan 2018 10:25:20 +0000 (18:25 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Thu, 11 Jan 2018 02:37:56 +0000 (10:37 +0800)
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 <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
UefiCpuPkg/Library/MtrrLib/MtrrLib.c

index 768d4d5..30b0df0 100644 (file)
@@ -1171,7 +1171,6 @@ MtrrLibCalculateLeastMtrrs (
 \r
   for (Index = Start; Index <= Stop; Index++) {\r
     Vertices[Index].Visited = FALSE;\r
-    Vertices[Index].Previous = VertexCount;\r
     Mandatory = Weight[M(Start,Index)];\r
     Vertices[Index].Weight = Mandatory;\r
     if (Mandatory != MAX_WEIGHT) {\r