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

Kun Qin kun.q at outlook.com
Mon Dec 28 04:07:37 UTC 2020


Jiewen,

Good point. Will update this in v2 patches.

Thanks,
Kun

From: Yao, Jiewen<mailto:jiewen.yao at intel.com>
Sent: Sunday, December 27, 2020 16:14
To: Kun Qin<mailto:kun.q at outlook.com>; devel at edk2.groups.io<mailto:devel at edk2.groups.io>
Cc: Ard Biesheuvel<mailto:ard.biesheuvel at arm.com>; Sami Mujawar<mailto:sami.mujawar at arm.com>; Supreeth Venkatesh<mailto:supreeth.venkatesh at arm.com>
Subject: RE: [PATCH v1 03/15] StandaloneMmPkg: StandaloneMmCoreMemoryAllocationLib: Fix compiler warning

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 (#69472): https://edk2.groups.io/g/devel/message/69472
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]
-=-=-=-=-=-=-=-=-=-=-=-


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/edk2-devel-archive/attachments/20201228/7ce38e9c/attachment.htm>


More information about the edk2-devel-archive mailing list