[edk2-devel] [PATCH v1 03/15] StandaloneMmPkg: StandaloneMmCoreMemoryAllocationLib: Fix compiler warning

Yao, Jiewen jiewen.yao at intel.com
Mon Dec 28 00:14:02 UTC 2020


Since below code is using (UINTN)MmramRangeCount,

MmInitializeMemoryServices ((UINTN)MmramRangeCount, (VOID *)(UINTN)MmramRanges);

I recommend to UINTN for MmramRangeCount, and use (UINTN) cast.

> -----Original Message-----
> From: Kun Qin <kun.q at outlook.com>
> Sent: Saturday, December 19, 2020 2:50 AM
> To: devel at edk2.groups.io
> Cc: Ard Biesheuvel <ard.biesheuvel at arm.com>; Sami Mujawar
> <sami.mujawar at arm.com>; Yao, Jiewen <jiewen.yao at intel.com>; Supreeth
> Venkatesh <supreeth.venkatesh at arm.com>
> Subject: [PATCH v1 03/15] 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 UINT64 type.
> 
> Cc: Ard Biesheuvel <ard.biesheuvel at arm.com>
> Cc: Sami Mujawar <sami.mujawar at arm.com>
> Cc: Jiewen Yao <jiewen.yao at intel.com>
> Cc: Supreeth Venkatesh <supreeth.venkatesh at arm.com>
> 
> Signed-off-by: Kun Qin <kun.q at outlook.com>
> ---
> 
> StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/Stan
> daloneMmCoreMemoryAllocationLib.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git
> a/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/Sta
> ndaloneMmCoreMemoryAllocationLib.c
> b/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/Sta
> ndaloneMmCoreMemoryAllocationLib.c
> index eb3d772e18c5..798d546a2037 100644
> ---
> a/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/Sta
> ndaloneMmCoreMemoryAllocationLib.c
> +++
> b/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/Sta
> ndaloneMmCoreMemoryAllocationLib.c
> @@ -841,7 +841,7 @@ MemoryAllocationLibConstructor (
>    VOID                            *HobStart;
>    EFI_MMRAM_HOB_DESCRIPTOR_BLOCK  *MmramRangesHobData;
>    EFI_MMRAM_DESCRIPTOR            *MmramRanges;
> -  UINT32                           MmramRangeCount;
> +  UINT64                           MmramRangeCount;
>    EFI_HOB_GUID_TYPE               *MmramRangesHob;
> 
>    HobStart = GetHobList ();
> --
> 2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#69467): https://edk2.groups.io/g/devel/message/69467
Mute This Topic: https://groups.io/mt/79068286/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