public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Kun Qin" <kun.q@outlook.com>
To: devel@edk2.groups.io
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>,
	Sami Mujawar <sami.mujawar@arm.com>,
	Jiewen Yao <jiewen.yao@intel.com>,
	Supreeth Venkatesh <supreeth.venkatesh@arm.com>,
	Jiewen Yao <Jiewen.yao@intel.com>
Subject: [PATCH v3 04/18] StandaloneMmPkg: StandaloneMmCoreMemoryAllocationLib: Fix compiler warning
Date: Thu, 14 Jan 2021 14:33:46 -0800	[thread overview]
Message-ID: <MWHPR06MB310208F035D00044E7585B3EF3A80@MWHPR06MB3102.namprd06.prod.outlook.com> (raw)
In-Reply-To: <20210114223400.2596-1-kun.q@outlook.com>

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@arm.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>

Signed-off-by: Kun Qin <kun.q@outlook.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
---

Notes:
    v3:
    - Added reviewed-by tag [Jiewen]
    
    v2:
    - Changed variable type to UINTN and cast before assignments [Jiewen]

 StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.c b/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.c
index 8fbd4d934784..ba5470dd7156 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;
   }
 
   {
-- 
2.30.0.windows.1


  parent reply	other threads:[~2021-01-14 22:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210114223400.2596-1-kun.q@outlook.com>
2021-01-14 22:33 ` [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list Kun Qin
2021-01-14 22:33 ` [PATCH v3 02/18] StandaloneMmPkg: StandaloneMmCoreEntryPoint: Extends support for X64 Kun Qin
2021-01-14 22:33 ` [PATCH v3 03/18] StandaloneMmPkg: StandaloneMmCoreHobLib: Extend support for x64 Mm Core Kun Qin
2021-01-14 22:33 ` Kun Qin [this message]
     [not found] ` <165A3A1108D15505.7065@groups.io>
2021-01-21  1:34   ` [edk2-devel] " Kun Qin
2021-01-26 12:39     ` Yao, Jiewen
     [not found] ` <165A3A10BD6EE08F.30138@groups.io>
2021-01-21  1:36   ` [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list Kun Qin
2021-01-21  1:45     ` 回复: " gaoliming
2021-01-21  1:54       ` Kun Qin
2021-01-22  0:27         ` 回复: " gaoliming
2021-01-26  5:41           ` Bob Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MWHPR06MB310208F035D00044E7585B3EF3A80@MWHPR06MB3102.namprd06.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox