> -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Philippe > Mathieu-Daudé > Sent: Thursday, November 11, 2021 2:24 AM > To: devel@edk2.groups.io; Kinney, Michael D <michael.d.kin...@intel.com> > Cc: Anthony Perard <anthony.per...@citrix.com>; Julien Grall > <jul...@xen.org>; Ard Biesheuvel <ardb+tianoc...@kernel.org>; > Yao, Jiewen <jiewen....@intel.com>; Justen, Jordan L > <jordan.l.jus...@intel.com>; Gerd Hoffmann <kra...@redhat.com> > Subject: Re: [edk2-devel] [Patch 1/1] OvmfPkg/Xen: Fix VS2019 build issues > > Hi Michael, > > On 11/8/21 17:22, Michael D Kinney wrote: > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3722 > > > > Fix VS2019 NOOPT build issues related to converting > > a larger integer value to a smaller integer value. > > > > Cc: Anthony Perard <anthony.per...@citrix.com> > > Cc: Julien Grall <jul...@xen.org> > > Cc: Ard Biesheuvel <ardb+tianoc...@kernel.org> > > Cc: Jiewen Yao <jiewen....@intel.com> > > Cc: Jordan Justen <jordan.l.jus...@intel.com> > > Cc: Gerd Hoffmann <kra...@redhat.com> > > Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com> > > --- > > .../Library/XenRealTimeClockLib/XenRealTimeClockLib.c | 10 +++++----- > > OvmfPkg/XenPlatformPei/MemDetect.c | 2 +- > > OvmfPkg/XenTimerDxe/XenTimerDxe.c | 4 ++-- > > 3 files changed, 8 insertions(+), 8 deletions(-) > > > > diff --git a/OvmfPkg/Library/XenRealTimeClockLib/XenRealTimeClockLib.c > b/OvmfPkg/Library/XenRealTimeClockLib/XenRealTimeClockLib.c > > index e113bc89bd75..72e0aaa8798c 100644 > > --- a/OvmfPkg/Library/XenRealTimeClockLib/XenRealTimeClockLib.c > > +++ b/OvmfPkg/Library/XenRealTimeClockLib/XenRealTimeClockLib.c > > @@ -53,9 +53,9 @@ EpochToEfiTime ( > > m = (((da * 5) + 308) / 153) - 2; > > d = da - (((m + 4) * 153) / 5) + 122; > > > > - Time->Year = y - 4800 + ((m + 2) / 12); > > + Time->Year = (UINT16)(y - 4800 + ((m + 2) / 12)); > > Time->Month = ((m + 2) % 12) + 1; > > - Time->Day = d + 1; > > + Time->Day = (UINT8)(d + 1); > > > > ss = EpochSeconds % 60; > > a = (EpochSeconds - ss) / 60; > > @@ -63,9 +63,9 @@ EpochToEfiTime ( > > b = (a - mm) / 60; > > hh = b % 24; > > > > - Time->Hour = hh; > > - Time->Minute = mm; > > - Time->Second = ss; > > + Time->Hour = (UINT8)hh; > > + Time->Minute = (UINT8)mm; > > + Time->Second = (UINT8)ss; > > Time->Nanosecond = 0; > > > > } > > I see this matches EmbeddedPkg::TimeBaseLib.c, but shouldn't both > implementations be safer using MdePkg::SafeIntLib.h?
I agree. Do you want to enter a BZ for this task with pointers to the source files that should update their math ops to use SafeIntLib? > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83657): https://edk2.groups.io/g/devel/message/83657 Mute This Topic: https://groups.io/mt/86909518/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-