From 0a13a624136bf2b278851316d8eae23611d93ad2 Mon Sep 17 00:00:00 2001 From: Star Zeng Date: Wed, 20 Aug 2014 07:05:55 +0000 Subject: MdeModulePkg PeiCore: Add NULL pointer check. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng Reviewed-by: Liming Gao Reviewed-by: Eric Dong git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15846 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Pei/PeiMain/PeiMain.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'MdeModulePkg/Core') diff --git a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c index d105fce28d..3220ffb8ee 100644 --- a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c +++ b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c @@ -313,17 +313,25 @@ PeiCore ( // Initialize PEI Core Private Data Buffer // PrivateData.PpiData.PpiListPtrs = AllocateZeroPool (sizeof (PEI_PPI_LIST_POINTERS) * PcdGet32 (PcdPeiCoreMaxPpiSupported)); + ASSERT (PrivateData.PpiData.PpiListPtrs != NULL); PrivateData.Fv = AllocateZeroPool (sizeof (PEI_CORE_FV_HANDLE) * PcdGet32 (PcdPeiCoreMaxFvSupported)); + ASSERT (PrivateData.Fv != NULL); PrivateData.Fv[0].PeimState = AllocateZeroPool (sizeof (UINT8) * PcdGet32 (PcdPeiCoreMaxPeimPerFv) * PcdGet32 (PcdPeiCoreMaxFvSupported)); + ASSERT (PrivateData.Fv[0].PeimState != NULL); PrivateData.Fv[0].FvFileHandles = AllocateZeroPool (sizeof (EFI_PEI_FILE_HANDLE) * PcdGet32 (PcdPeiCoreMaxPeimPerFv) * PcdGet32 (PcdPeiCoreMaxFvSupported)); + ASSERT (PrivateData.Fv[0].FvFileHandles != NULL); for (Index = 1; Index < PcdGet32 (PcdPeiCoreMaxFvSupported); Index ++) { PrivateData.Fv[Index].PeimState = PrivateData.Fv[Index - 1].PeimState + PcdGet32 (PcdPeiCoreMaxPeimPerFv); PrivateData.Fv[Index].FvFileHandles = PrivateData.Fv[Index - 1].FvFileHandles + PcdGet32 (PcdPeiCoreMaxPeimPerFv); } PrivateData.UnknownFvInfo = AllocateZeroPool (sizeof (PEI_CORE_UNKNOW_FORMAT_FV_INFO) * PcdGet32 (PcdPeiCoreMaxFvSupported)); + ASSERT (PrivateData.UnknownFvInfo != NULL); PrivateData.CurrentFvFileHandles = AllocateZeroPool (sizeof (EFI_PEI_FILE_HANDLE) * PcdGet32 (PcdPeiCoreMaxPeimPerFv)); + ASSERT (PrivateData.CurrentFvFileHandles != NULL); PrivateData.FileGuid = AllocatePool (sizeof (EFI_GUID) * PcdGet32 (PcdPeiCoreMaxPeimPerFv)); + ASSERT (PrivateData.FileGuid != NULL); PrivateData.FileHandles = AllocatePool (sizeof (EFI_PEI_FILE_HANDLE) * (PcdGet32 (PcdPeiCoreMaxPeimPerFv) + 1)); + ASSERT (PrivateData.FileHandles != NULL); } InitializePpiServices (&PrivateData, OldCoreData); -- cgit v1.2.3