From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web10.4515.1612324274226464451 for ; Tue, 02 Feb 2021 19:51:14 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@linux.microsoft.com header.s=default header.b=HBcDP/Rj; spf=pass (domain: linux.microsoft.com, ip: 13.77.154.182, mailfrom: mikuback@linux.microsoft.com) Received: from localhost.localdomain (unknown [131.107.174.202]) by linux.microsoft.com (Postfix) with ESMTPSA id 980BB20B7192; Tue, 2 Feb 2021 19:51:13 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 980BB20B7192 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1612324273; bh=93+ZfnTGz+OCg/uAsIuaA1JOcRigAaGJeCArY3hjJTE=; h=From:To:Cc:Subject:Date:From; b=HBcDP/Rjx79h26KteDNND4k73Mce9GtCbbCA8E8zuVWAAHyXtgon8Um9LjO8RFaZY kXSp4F4clI9qD4L66Pd6f57BgU2vD2MQUeW7gXM+FC2kjn1qod2jW7eUKxrzzZD3UI /1rGUAN4XjDBDqKsJJKgOnazGA1k0Y0AqJOfh+7c= From: mikuback@linux.microsoft.com To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar , Jiewen Yao , Supreeth Venkatesh Subject: [PATCH v1 1/1] StandaloneMmPkg/StandaloneMmCore: Fix compiler warning Date: Tue, 2 Feb 2021 19:50:52 -0800 Message-Id: <20210203035052.402-1-mikuback@linux.microsoft.com> X-Mailer: git-send-email 2.28.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3204 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: '=3D': conversion from 'UINT64' to 'UINT32', possible loss of data Cc: Ard Biesheuvel Cc: Sami Mujawar Cc: Jiewen Yao Cc: Supreeth Venkatesh Signed-off-by: Michael Kubacki --- StandaloneMmPkg/Core/StandaloneMmCore.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.c b/StandaloneMmPkg/Co= re/StandaloneMmCore.c index 8388ec289ca8..d254a68f2fb8 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; =20 ProcessLibraryConstructorList (HobStart, &gMmCoreMmst); @@ -546,7 +546,7 @@ StandaloneMmMain ( MmramRangesHobData =3D GET_GUID_HOB_DATA (MmramRangesHob); ASSERT (MmramRangesHobData !=3D NULL); MmramRanges =3D MmramRangesHobData->Descriptor; - MmramRangeCount =3D MmramRangesHobData->NumberOfMmReservedRegions; + MmramRangeCount =3D (UINTN) MmramRangesHobData->NumberOfMmReservedRe= gions; ASSERT (MmramRanges); ASSERT (MmramRangeCount); =20 @@ -554,7 +554,7 @@ StandaloneMmMain ( // Copy the MMRAM ranges into MM_CORE_PRIVATE_DATA table just in cas= e any // code relies on them being present there // - gMmCorePrivate->MmramRangeCount =3D MmramRangeCount; + gMmCorePrivate->MmramRangeCount =3D (UINT64) MmramRangeCount; gMmCorePrivate->MmramRanges =3D (EFI_PHYSICAL_ADDRESS)(UINTN)AllocatePool (MmramRangeCount * sizeo= f (EFI_MMRAM_DESCRIPTOR)); ASSERT (gMmCorePrivate->MmramRanges !=3D 0); @@ -567,7 +567,7 @@ StandaloneMmMain ( DataInHob =3D GET_GUID_HOB_DATA (GuidHob); gMmCorePrivate =3D (MM_CORE_PRIVATE_DATA *)(UINTN)DataInHob->Address= ; MmramRanges =3D (EFI_MMRAM_DESCRIPTOR *)(UINTN)gMmCorePrivate->M= mramRanges; - MmramRangeCount =3D gMmCorePrivate->MmramRangeCount; + MmramRangeCount =3D (UINTN) gMmCorePrivate->MmramRangeCount; } =20 // --=20 2.28.0.windows.1