[edk2-devel] [PATCH v3 09/26] StandaloneMmPkg: Fix ECC error 5007 in StandaloneMmCpu

Sami Mujawar sami.mujawar at arm.com
Mon Jan 4 13:21:56 UTC 2021


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 <sami.mujawar at arm.com>
Acked-by: Jiewen Yao <Jiewen.yao at intel.com>
---

Notes:
    v3:
     - No code change. Added bugzilla ID and resending patch     [SAMI]
       with v3 series.
    
    v2:
     - No code change. Resending patch with v2 series.           [SAMI]

 StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/EventHandle.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/EventHandle.c b/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/EventHandle.c
index 9738e8bd60149efb45ef1b66139e0cec38b6c1fe..7620a65c7e3bbd647961942f5b30d3d834107f70 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;
 
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#69565): https://edk2.groups.io/g/devel/message/69565
Mute This Topic: https://groups.io/mt/79423270/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list