]> git.proxmox.com Git - mirror_edk2.git/commitdiff
StandaloneMmPkg: StandaloneMmCoreMemoryAllocationLib: Fix compiler warning
authorKun Qin <kun.q@outlook.com>
Fri, 18 Dec 2020 02:51:05 +0000 (18:51 -0800)
committerKun Qin <kun.q@outlook.com>
Mon, 1 Feb 2021 18:01:02 +0000 (10:01 -0800)
Assigning MmramRangeCount from MmCorePrivate (UINT64) to local variable
MmramRangeCount (UINT32) will cause compilation failure due to "warning
C4244: '=': conversion from 'UINT64' to 'UINT32', possible loss of data".
This changes defines local MmramRangeCount as UINTN type and adds type
cast before value assignment.

Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Signed-off-by: Kun Qin <kun.q@outlook.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.c

index 8fbd4d9347849b2771bb402626f02f9402df8a76..ba5470dd7156ace4fe55bfab1790b64f5ac43096 100644 (file)
@@ -841,7 +841,7 @@ MemoryAllocationLibConstructor (
   VOID                            *HobStart;\r
   EFI_MMRAM_HOB_DESCRIPTOR_BLOCK  *MmramRangesHobData;\r
   EFI_MMRAM_DESCRIPTOR            *MmramRanges;\r
-  UINT32                           MmramRangeCount;\r
+  UINT                           MmramRangeCount;\r
   EFI_HOB_GUID_TYPE               *MmramRangesHob;\r
 \r
   HobStart = GetHobList ();\r
@@ -868,7 +868,7 @@ MemoryAllocationLibConstructor (
       return EFI_UNSUPPORTED;\r
     }\r
 \r
-    MmramRangeCount = MmramRangesHobData->NumberOfMmReservedRegions;\r
+    MmramRangeCount = (UINTN) MmramRangesHobData->NumberOfMmReservedRegions;\r
     if (MmramRanges == NULL) {\r
       return EFI_UNSUPPORTED;\r
     }\r
@@ -877,7 +877,7 @@ MemoryAllocationLibConstructor (
     DataInHob      = GET_GUID_HOB_DATA (GuidHob);\r
     MmCorePrivate = (MM_CORE_PRIVATE_DATA *)(UINTN)DataInHob->Address;\r
     MmramRanges     = (EFI_MMRAM_DESCRIPTOR *)(UINTN)MmCorePrivate->MmramRanges;\r
-    MmramRangeCount = MmCorePrivate->MmramRangeCount;\r
+    MmramRangeCount = (UINTN) MmCorePrivate->MmramRangeCount;\r
   }\r
 \r
   {\r