From: Sami Mujawar Date: Thu, 3 Dec 2020 20:22:22 +0000 (+0000) Subject: StandaloneMmPkg: Fix ECC error 5007 in StandaloneMmCpu X-Git-Tag: edk2-stable202102~205 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=eda1ffacf1b4aa2b466c5e30334eb88f7a23dcfc StandaloneMmPkg: Fix ECC error 5007 in StandaloneMmCpu Bugzilla: 3150 (https://bugzilla.tianocore.org/show_bug.cgi?id=3150) Fix ECC error "[5007] There should be no initialization of a variable as part of its declaration Variable." Signed-off-by: Sami Mujawar Acked-by: Jiewen Yao Acked-by: Ard Biesheuvel Reviewed-by: Liming Gao --- diff --git a/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/EventHandle.c b/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/EventHandle.c index 2087748053..2313d3f9b3 100644 --- a/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/EventHandle.c +++ b/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/EventHandle.c @@ -65,8 +65,8 @@ PiMmStandaloneArmTfCpuDriverEntry ( IN UINTN NsCommBufferAddr ) { - EFI_MM_COMMUNICATE_HEADER *GuidedEventContext = NULL; - EFI_MM_ENTRY_CONTEXT MmEntryPointContext = {0}; + EFI_MM_COMMUNICATE_HEADER *GuidedEventContext; + EFI_MM_ENTRY_CONTEXT MmEntryPointContext; EFI_STATUS Status; UINTN NsCommBufferSize; @@ -107,6 +107,7 @@ PiMmStandaloneArmTfCpuDriverEntry ( return EFI_ACCESS_DENIED; } + GuidedEventContext = NULL; // Now that the secure world can see the normal world buffer, allocate // memory to copy the communication buffer to the secure world. Status = mMmst->MmAllocatePool ( @@ -127,6 +128,8 @@ PiMmStandaloneArmTfCpuDriverEntry ( // Stash the pointer to the allocated Event Context for this CPU PerCpuGuidedEventContext[CpuNumber] = GuidedEventContext; + ZeroMem (&MmEntryPointContext, sizeof (EFI_MM_ENTRY_CONTEXT)); + MmEntryPointContext.CurrentlyExecutingCpu = CpuNumber; MmEntryPointContext.NumberOfCpus = mMpInformationHobData->NumberOfProcessors;