On 03/10/20 09:44, Bob Feng wrote: > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2580 > > Ovmf build failed on Windows with VS2017 tool chain. > The error message like: > > OvmfPkg\LinuxInitrdDynamicShellCommand\LinuxInitr > dDynamicShellCommand.c(199): error C2220: warning treated as error - > no 'object' file generated > OvmfPkg\LinuxInitrdDynamicShellCommand\LinuxInitrdDynamicShellCommand.c(199): > warning C4244: '=': conversion from 'UINT64' to 'UINTN', > possible loss of data > > This patch is to cast UINT64 type to UINTN type > when doing the variable assignment. > > Signed-off-by: Bob Feng <bob.c.f...@intel.com> > Cc: Ard Biesheuvel <ard.biesheu...@linaro.org> > Cc: Laszlo Ersek <ler...@redhat.com> > --- > .../LinuxInitrdDynamicShellCommand.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git > a/OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.c > b/OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.c > index 021b072826a9..07baa0e8d100 100644 > --- a/OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.c > +++ b/OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.c > @@ -194,11 +194,11 @@ CacheInitrdFile ( > &gEfiLoadFile2ProtocolGuid, &mInitrdLoadFile2, > NULL); > ASSERT_EFI_ERROR (Status); > } > > - mInitrdFileSize = FileSize; > + mInitrdFileSize = (UINTN)FileSize; > return EFI_SUCCESS; > > FreeMemory: > gBS->FreePages (mInitrdFileAddress, EFI_SIZE_TO_PAGES ((UINTN)FileSize)); > return Status; >
Yes, this patch is safe; the function catches (FileSize > MAX_UINTN) gracefully, near the top. Reviewed-by: Laszlo Ersek <ler...@redhat.com> Thank you very much for the patch! Laszlo -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#55713): https://edk2.groups.io/g/devel/message/55713 Mute This Topic: https://groups.io/mt/71853177/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-