From 2b9006762d2fb3637bd3a7d472f66c51aa8246f0 Mon Sep 17 00:00:00 2001 From: Kun Qin Date: Thu, 17 Dec 2020 18:51:05 -0800 Subject: StandaloneMmPkg: StandaloneMmCoreMemoryAllocationLib: Fix compiler warning 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 Cc: Sami Mujawar Cc: Jiewen Yao Cc: Supreeth Venkatesh Signed-off-by: Kun Qin Reviewed-by: Jiewen Yao --- .../StandaloneMmCoreMemoryAllocationLib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'StandaloneMmPkg') diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.c b/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.c index 8fbd4d9347..ba5470dd71 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.c @@ -841,7 +841,7 @@ MemoryAllocationLibConstructor ( VOID *HobStart; EFI_MMRAM_HOB_DESCRIPTOR_BLOCK *MmramRangesHobData; EFI_MMRAM_DESCRIPTOR *MmramRanges; - UINT32 MmramRangeCount; + UINTN MmramRangeCount; EFI_HOB_GUID_TYPE *MmramRangesHob; HobStart = GetHobList (); @@ -868,7 +868,7 @@ MemoryAllocationLibConstructor ( return EFI_UNSUPPORTED; } - MmramRangeCount = MmramRangesHobData->NumberOfMmReservedRegions; + MmramRangeCount = (UINTN) MmramRangesHobData->NumberOfMmReservedRegions; if (MmramRanges == NULL) { return EFI_UNSUPPORTED; } @@ -877,7 +877,7 @@ MemoryAllocationLibConstructor ( DataInHob = GET_GUID_HOB_DATA (GuidHob); MmCorePrivate = (MM_CORE_PRIVATE_DATA *)(UINTN)DataInHob->Address; MmramRanges = (EFI_MMRAM_DESCRIPTOR *)(UINTN)MmCorePrivate->MmramRanges; - MmramRangeCount = MmCorePrivate->MmramRangeCount; + MmramRangeCount = (UINTN) MmCorePrivate->MmramRangeCount; } { -- cgit v1.2.3