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.web08.2328.1613005486957328027 for ; Wed, 10 Feb 2021 17:04:47 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@linux.microsoft.com header.s=default header.b=mnuqBQRg; 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 7CD5020B6C40; Wed, 10 Feb 2021 17:04:46 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 7CD5020B6C40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1613005486; bh=0i0oywE9Dm3D8l9UTwsAGPiN/AfBC8zCZB8X1N8bQT0=; h=From:To:Cc:Subject:Date:From; b=mnuqBQRgcLjJefVnd/laosrvE5HsHl8vqd7yEpG1PmY1nxixsoMCvZJnObnhVuFG7 ZcxcmWcagi5pHRaJ6MpTm7VgOHqTz3t+qaD0ooWv0AA5xktZyohaNixn8qreZQfB36 e6DB7GXdPjwL2KJcKkiSoYx/T6K77u5LA+XfGThQ= From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar , Jiewen Yao , Supreeth Venkatesh Subject: [PATCH v2 1/1] StandaloneMmPkg/StandaloneMmCore: Fix compiler warning Date: Wed, 10 Feb 2021 17:04:20 -0800 Message-Id: <20210211010420.1568-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 Reviewed-by: Sami Mujawar --- Notes: V2 changes: Remove whitespace after typecast. Update Ard's email addr= ess 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..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; =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->NumberOfMmReservedReg= ions; 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