From 8ab6d73c0e240d573cdce317a15317f235d24ac4 Mon Sep 17 00:00:00 2001 From: Chen Fan Date: Sun, 28 Sep 2014 06:21:46 +0000 Subject: [PATCH] EmulatorPkg/MpService: Fix a NULL reference when making a CreateEvent() to call CpuCheckAllAPsStatus(), the Context parameter was NULL in CpuCheckAllAPsStatus(), so we must not use the Context as the ProcessorData pointer. and should recalculate it. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chen Fan Reviewed-by: Jordan Justen git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16183 6f19259b-4bc3-4df7-8a09-765794883524 --- EmulatorPkg/CpuRuntimeDxe/MpService.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/EmulatorPkg/CpuRuntimeDxe/MpService.c b/EmulatorPkg/CpuRuntimeDxe/MpService.c index 536a47f7ec..ed57d7a0a3 100644 --- a/EmulatorPkg/CpuRuntimeDxe/MpService.c +++ b/EmulatorPkg/CpuRuntimeDxe/MpService.c @@ -984,10 +984,9 @@ CpuCheckAllAPsStatus ( gMPSystem.Timeout -= gPollInterval; } - ProcessorData = (PROCESSOR_DATA_BLOCK *) Context; - for (ProcessorNumber = 0; ProcessorNumber < gMPSystem.NumberOfProcessors; ProcessorNumber++) { - if ((ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_AS_BSP_BIT) == PROCESSOR_AS_BSP_BIT) { + ProcessorData = &gMPSystem.ProcessorData[ProcessorNumber]; + if ((ProcessorData->Info.StatusFlag & PROCESSOR_AS_BSP_BIT) == PROCESSOR_AS_BSP_BIT) { // Skip BSP continue; } @@ -1045,7 +1044,8 @@ CpuCheckAllAPsStatus ( // if (gMPSystem.FailedList != NULL) { for (ProcessorNumber = 0; ProcessorNumber < gMPSystem.NumberOfProcessors; ProcessorNumber++) { - if ((ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_AS_BSP_BIT) == PROCESSOR_AS_BSP_BIT) { + ProcessorData = &gMPSystem.ProcessorData[ProcessorNumber]; + if ((ProcessorData->Info.StatusFlag & PROCESSOR_AS_BSP_BIT) == PROCESSOR_AS_BSP_BIT) { // Skip BSP continue; } -- 2.39.2