public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 1/1] StandaloneMmPkg/StandaloneMmCore: Fix compiler warning
@ 2021-02-11  1:04 Michael Kubacki
  2021-02-11  8:52 ` Ard Biesheuvel
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Kubacki @ 2021-02-11  1:04 UTC (permalink / raw)
  To: devel; +Cc: Ard Biesheuvel, Sami Mujawar, Jiewen Yao, Supreeth Venkatesh

From: Michael Kubacki <michael.kubacki@microsoft.com>

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3204

Fixes the following compiler warning in VS2019 by changing defining
the MmramRangeCount variable to be UINTN and type casting prior
to value assignment.

\edk2\StandaloneMmPkg\Core\StandaloneMmCore.c(570): error C2220:
  the following warning is treated as an error
\edk2\StandaloneMmPkg\Core\StandaloneMmCore.c(570): warning C4244:
  '=': conversion from 'UINT64' to 'UINT32', possible loss of data

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
---

Notes:
    V2 changes: Remove whitespace after typecast. Update Ard's email address

 StandaloneMmPkg/Core/StandaloneMmCore.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.c b/StandaloneMmPkg/Core/StandaloneMmCore.c
index 8388ec289ca8..fbb0ec75e557 100644
--- a/StandaloneMmPkg/Core/StandaloneMmCore.c
+++ b/StandaloneMmPkg/Core/StandaloneMmCore.c
@@ -511,7 +511,7 @@ StandaloneMmMain (
   EFI_HOB_GUID_TYPE               *MmramRangesHob;
   EFI_MMRAM_HOB_DESCRIPTOR_BLOCK  *MmramRangesHobData;
   EFI_MMRAM_DESCRIPTOR            *MmramRanges;
-  UINT32                          MmramRangeCount;
+  UINTN                           MmramRangeCount;
   EFI_HOB_FIRMWARE_VOLUME         *BfvHob;
 
   ProcessLibraryConstructorList (HobStart, &gMmCoreMmst);
@@ -546,7 +546,7 @@ StandaloneMmMain (
     MmramRangesHobData = GET_GUID_HOB_DATA (MmramRangesHob);
     ASSERT (MmramRangesHobData != NULL);
     MmramRanges = MmramRangesHobData->Descriptor;
-    MmramRangeCount = MmramRangesHobData->NumberOfMmReservedRegions;
+    MmramRangeCount = (UINTN)MmramRangesHobData->NumberOfMmReservedRegions;
     ASSERT (MmramRanges);
     ASSERT (MmramRangeCount);
 
@@ -554,7 +554,7 @@ StandaloneMmMain (
     // Copy the MMRAM ranges into MM_CORE_PRIVATE_DATA table just in case any
     // code relies on them being present there
     //
-    gMmCorePrivate->MmramRangeCount = MmramRangeCount;
+    gMmCorePrivate->MmramRangeCount = (UINT64)MmramRangeCount;
     gMmCorePrivate->MmramRanges =
       (EFI_PHYSICAL_ADDRESS)(UINTN)AllocatePool (MmramRangeCount * sizeof (EFI_MMRAM_DESCRIPTOR));
     ASSERT (gMmCorePrivate->MmramRanges != 0);
@@ -567,7 +567,7 @@ StandaloneMmMain (
     DataInHob       = GET_GUID_HOB_DATA (GuidHob);
     gMmCorePrivate = (MM_CORE_PRIVATE_DATA *)(UINTN)DataInHob->Address;
     MmramRanges     = (EFI_MMRAM_DESCRIPTOR *)(UINTN)gMmCorePrivate->MmramRanges;
-    MmramRangeCount = gMmCorePrivate->MmramRangeCount;
+    MmramRangeCount = (UINTN)gMmCorePrivate->MmramRangeCount;
   }
 
   //
-- 
2.28.0.windows.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 1/1] StandaloneMmPkg/StandaloneMmCore: Fix compiler warning
  2021-02-11  1:04 [PATCH v2 1/1] StandaloneMmPkg/StandaloneMmCore: Fix compiler warning Michael Kubacki
@ 2021-02-11  8:52 ` Ard Biesheuvel
  0 siblings, 0 replies; 2+ messages in thread
From: Ard Biesheuvel @ 2021-02-11  8:52 UTC (permalink / raw)
  To: Michael Kubacki
  Cc: devel, Ard Biesheuvel, Sami Mujawar, Jiewen Yao,
	Supreeth Venkatesh

On Thu, 11 Feb 2021 at 02:04, <mikuback@linux.microsoft.com> wrote:
>
> From: Michael Kubacki <michael.kubacki@microsoft.com>
>
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3204
>
> Fixes the following compiler warning in VS2019 by changing defining
> the MmramRangeCount variable to be UINTN and type casting prior
> to value assignment.
>
> \edk2\StandaloneMmPkg\Core\StandaloneMmCore.c(570): error C2220:
>   the following warning is treated as an error
> \edk2\StandaloneMmPkg\Core\StandaloneMmCore.c(570): warning C4244:
>   '=': conversion from 'UINT64' to 'UINT32', possible loss of data
>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Sami Mujawar <sami.mujawar@arm.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>

Merged, thanks.

> ---
>
> Notes:
>     V2 changes: Remove whitespace after typecast. Update Ard's email address
>
>  StandaloneMmPkg/Core/StandaloneMmCore.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.c b/StandaloneMmPkg/Core/StandaloneMmCore.c
> index 8388ec289ca8..fbb0ec75e557 100644
> --- a/StandaloneMmPkg/Core/StandaloneMmCore.c
> +++ b/StandaloneMmPkg/Core/StandaloneMmCore.c
> @@ -511,7 +511,7 @@ StandaloneMmMain (
>    EFI_HOB_GUID_TYPE               *MmramRangesHob;
>    EFI_MMRAM_HOB_DESCRIPTOR_BLOCK  *MmramRangesHobData;
>    EFI_MMRAM_DESCRIPTOR            *MmramRanges;
> -  UINT32                          MmramRangeCount;
> +  UINTN                           MmramRangeCount;
>    EFI_HOB_FIRMWARE_VOLUME         *BfvHob;
>
>    ProcessLibraryConstructorList (HobStart, &gMmCoreMmst);
> @@ -546,7 +546,7 @@ StandaloneMmMain (
>      MmramRangesHobData = GET_GUID_HOB_DATA (MmramRangesHob);
>      ASSERT (MmramRangesHobData != NULL);
>      MmramRanges = MmramRangesHobData->Descriptor;
> -    MmramRangeCount = MmramRangesHobData->NumberOfMmReservedRegions;
> +    MmramRangeCount = (UINTN)MmramRangesHobData->NumberOfMmReservedRegions;
>      ASSERT (MmramRanges);
>      ASSERT (MmramRangeCount);
>
> @@ -554,7 +554,7 @@ StandaloneMmMain (
>      // Copy the MMRAM ranges into MM_CORE_PRIVATE_DATA table just in case any
>      // code relies on them being present there
>      //
> -    gMmCorePrivate->MmramRangeCount = MmramRangeCount;
> +    gMmCorePrivate->MmramRangeCount = (UINT64)MmramRangeCount;
>      gMmCorePrivate->MmramRanges =
>        (EFI_PHYSICAL_ADDRESS)(UINTN)AllocatePool (MmramRangeCount * sizeof (EFI_MMRAM_DESCRIPTOR));
>      ASSERT (gMmCorePrivate->MmramRanges != 0);
> @@ -567,7 +567,7 @@ StandaloneMmMain (
>      DataInHob       = GET_GUID_HOB_DATA (GuidHob);
>      gMmCorePrivate = (MM_CORE_PRIVATE_DATA *)(UINTN)DataInHob->Address;
>      MmramRanges     = (EFI_MMRAM_DESCRIPTOR *)(UINTN)gMmCorePrivate->MmramRanges;
> -    MmramRangeCount = gMmCorePrivate->MmramRangeCount;
> +    MmramRangeCount = (UINTN)gMmCorePrivate->MmramRangeCount;
>    }
>
>    //
> --
> 2.28.0.windows.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-11  8:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-11  1:04 [PATCH v2 1/1] StandaloneMmPkg/StandaloneMmCore: Fix compiler warning Michael Kubacki
2021-02-11  8:52 ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox