From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mx.groups.io with SMTP id smtpd.web10.6016.1613033590626105952 for ; Thu, 11 Feb 2021 00:53:10 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Gyb4LgXQ; spf=pass (domain: kernel.org, ip: 198.145.29.99, mailfrom: ardb@kernel.org) Received: by mail.kernel.org (Postfix) with ESMTPSA id 089AD64E7D for ; Thu, 11 Feb 2021 08:53:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613033590; bh=ower8lqzYjkqF7HLWU70tcjwvNnw+rPBmr4HUY22H0U=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Gyb4LgXQOBmjikEL+c19LUZjS0ENM3pt2aBzoFv1v5Zq/i8GcBSfAYOCevPYGnvWD ePysA/T9ph6qT+0Wp03rz6QnLn8C9dY8exA6ccVJuDrOnj5eZKceqYZlbKFhmdao2v sVviF3ly29C7D0bK1vxDaHGGZww+IAU5f/UDscFqJ+6UYyNvZePsp1q3d5fZuT6fS4 KfLwQ5JWsOPkhAaKa5u8+bUHtAP9gai80gsWtHsfvb8xP2KkKWnLNToXYtHfvUC8iR D65RgLUbeh2CaPhXRI3mcz97k94qPCv1ihYRLebQgxH9UiK84KseRqJvgBWp3O1iSR ZBIvOHJ8ZSYEw== Received: by mail-oi1-f174.google.com with SMTP id l19so5275135oih.6 for ; Thu, 11 Feb 2021 00:53:10 -0800 (PST) X-Gm-Message-State: AOAM531+2cy0pXyi0Xfqboby+CkbNgL3kLl9QRrrOvON3udqvWo+GGO/ erSMQmkqPFR0sGKL+5xN4NoNRqHvb/1VQwOlAc8= X-Google-Smtp-Source: ABdhPJxMjkFOfduQj3rxu097zBo2Oo/LFFYHcmJnAYBnwcpd6sHjqwKEYByzOlMYH49aZ0joF35zwYYgif8UhFBpxt4= X-Received: by 2002:aca:b6c1:: with SMTP id g184mr2047367oif.47.1613033589430; Thu, 11 Feb 2021 00:53:09 -0800 (PST) MIME-Version: 1.0 References: <20210211010420.1568-1-mikuback@linux.microsoft.com> In-Reply-To: <20210211010420.1568-1-mikuback@linux.microsoft.com> From: "Ard Biesheuvel" Date: Thu, 11 Feb 2021 09:52:58 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 1/1] StandaloneMmPkg/StandaloneMmCore: Fix compiler warning To: Michael Kubacki Cc: devel@edk2.groups.io, Ard Biesheuvel , Sami Mujawar , Jiewen Yao , Supreeth Venkatesh Content-Type: text/plain; charset="UTF-8" On Thu, 11 Feb 2021 at 02:04, wrote: > > From: Michael Kubacki > > 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 > Cc: Sami Mujawar > Cc: Jiewen Yao > Cc: Supreeth Venkatesh > Signed-off-by: Michael Kubacki > Reviewed-by: Sami Mujawar 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 >