From: Liming Gao Date: Wed, 16 May 2018 01:35:01 +0000 (+0800) Subject: MdeModulePkg PeiCore: FvCount to be checked for the registered for shadow PEIM X-Git-Tag: edk2-stable201903~1710 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=b22d093101b0dee64f289407629bb872933aa2f2 MdeModulePkg PeiCore: FvCount to be checked for the registered for shadow PEIM 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 Cc: Star Zeng Reviewed-by: Star Zeng --- diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c index 027176d872..0ac3fdde6a 100644 --- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c +++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c @@ -976,7 +976,7 @@ PeiDispatcher ( SaveCurrentFvCount = Private->CurrentPeimFvCount; SaveCurrentFileHandle = Private->CurrentFileHandle; - for (Index1 = 0; Index1 <= SaveCurrentFvCount; Index1++) { + for (Index1 = 0; Index1 < Private->FvCount; Index1++) { for (Index2 = 0; (Index2 < PcdGet32 (PcdPeiCoreMaxPeimPerFv)) && (Private->Fv[Index1].FvFileHandles[Index2] != NULL); Index2++) { if (Private->Fv[Index1].PeimState[Index2] == PEIM_STATE_REGISTER_FOR_SHADOW) { PeimFileHandle = Private->Fv[Index1].FvFileHandles[Index2];