MdeModulePkg PeiCore: FvCount to be checked for the registered for shadow PEIM
authorLiming Gao <liming.gao@intel.com>
Wed, 16 May 2018 01:35:01 +0000 (09:35 +0800)
committerLiming Gao <liming.gao@intel.com>
Thu, 17 May 2018 07:22:27 +0000 (15:22 +0800)
The PEIM in all cached FV image may be in registered for shadow status.
Current logic CurrentPeimFvCount is not enough.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c

index 027176d..0ac3fdd 100644 (file)
@@ -976,7 +976,7 @@ PeiDispatcher (
     SaveCurrentFvCount    = Private->CurrentPeimFvCount;\r
     SaveCurrentFileHandle =  Private->CurrentFileHandle;\r
 \r
-    for (Index1 = 0; Index1 <= SaveCurrentFvCount; Index1++) {\r
+    for (Index1 = 0; Index1 < Private->FvCount; Index1++) {\r
       for (Index2 = 0; (Index2 < PcdGet32 (PcdPeiCoreMaxPeimPerFv)) && (Private->Fv[Index1].FvFileHandles[Index2] != NULL); Index2++) {\r
         if (Private->Fv[Index1].PeimState[Index2] == PEIM_STATE_REGISTER_FOR_SHADOW) {\r
           PeimFileHandle = Private->Fv[Index1].FvFileHandles[Index2];\r