[edk2-devel] [PATCH v2 03/16] StandaloneMmPkg: StandaloneMmCoreMemoryAllocationLib: Fix compiler warning

Yao, Jiewen jiewen.yao at intel.com
Wed Jan 6 03:33:56 UTC 2021


Reviewed-by: Jiewen Yao <Jiewen.yao at intel.com>

> -----Original Message-----
> From: Kun Qin <kun.q at outlook.com>
> Sent: Wednesday, January 6, 2021 2:59 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 v2 03/16] 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 <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>
> ---
> 
> Notes:
>     v2:
>     - Changed variable type to UINTN and cast before assignments [Jiewen]
> 
> 
> StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/Stan
> daloneMmCoreMemoryAllocationLib.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git
> a/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/Sta
> ndaloneMmCoreMemoryAllocationLib.c
> b/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/Sta
> ndaloneMmCoreMemoryAllocationLib.c
> index eb3d772e18c5..c6feb25a3821 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;
> +  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;
>    }
> 
>    {
> --
> 2.30.0.windows.1



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