From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.8783.1636626252991135065 for ; Thu, 11 Nov 2021 02:24:13 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hSdIrFIW; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: philmd@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636626252; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CzZNjcwlIFN3/if+6ARHuHD1N49IkIRywIhjDRRbR/c=; b=hSdIrFIW4a0hEpYPYdLkisT8sQkl/y9R4FCXtv/q07iCQOSk6j+dtY7zwlDzSCuieVFQdn 6flZZgNGvU8yLUddTRYeFeYMk25LNp/tz3w2tFRgMUJir/xvl1kf2iy2m1RsGvtco/Z0So GrmFRDRKU0STnGNRvse+V8ie+Yf/WL8= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-42-XMS8_iCIPJ-5UxwSMQ4j9g-1; Thu, 11 Nov 2021 05:24:09 -0500 X-MC-Unique: XMS8_iCIPJ-5UxwSMQ4j9g-1 Received: by mail-wm1-f72.google.com with SMTP id c1-20020a05600c0ac100b00322fcaa2bc7so2470077wmr.4 for ; Thu, 11 Nov 2021 02:24:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=CzZNjcwlIFN3/if+6ARHuHD1N49IkIRywIhjDRRbR/c=; b=oW78/jdpWVejXsICx+049gqsvZqE7AIVaiaUevdWc5aPA8LMtUNKrOc6vFb1AMH99A PCHu40uoUvqNygT/MjD+rC8QLf0JzZVia7PwnsQCEXdNhGBj54RYvaTq8RIzuWJFScYj 3oHRPv/9jgGLRKrdydgXMG74l6qFphUzlytL9ma5eqbEWrKEPWY132HdKnnTK6jl9JJS Wh1LSSJeEvC+9cjwR7zubntSaSrzwc/bEAqzwOlU3cNhFDi2v2ZpWC9N28lxlLldMkTk NoJJ5lMobuRbdOqQzTKnPBgBA07fD6yWRPoJmbcPiI9AwzrLYbTnr6TtJh7IN79tY0LJ KPRw== X-Gm-Message-State: AOAM5328umE5m21DAmsot1svIYr8j6ZQkK2WBHwclU1uHznHs/yRuTFb +h5HHFuW/LQ/xtwPXgMZhWf9y/sTh/l9Ab0eu5pJJczvoGnMVpQ4aoeFxtUp1/pobSMGIEi57hu qYdgmnW/NHnhAfVmxrNfwdvx9g/ZfatnTDuW+a+WuoAulnwbPHpZQU0+5SfVMjwo= X-Received: by 2002:a7b:c207:: with SMTP id x7mr24540741wmi.108.1636626247638; Thu, 11 Nov 2021 02:24:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJwTXBbcPbyH73dgTwEqk+FGA6lAk7J1nI46FeAGxmmjMODbEVNXukuyZiTUIS4H8u303vYqtQ== X-Received: by 2002:a7b:c207:: with SMTP id x7mr24540699wmi.108.1636626247303; Thu, 11 Nov 2021 02:24:07 -0800 (PST) Return-Path: Received: from [192.168.1.36] (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id h27sm9354895wmc.43.2021.11.11.02.24.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 11 Nov 2021 02:24:06 -0800 (PST) Message-ID: <5ab0569c-d9e9-a4a2-dae2-a80dba9a164c@redhat.com> Date: Thu, 11 Nov 2021 11:24:06 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [edk2-devel] [Patch 1/1] OvmfPkg/Xen: Fix VS2019 build issues To: devel@edk2.groups.io, michael.d.kinney@intel.com Cc: Anthony Perard , Julien Grall , Ard Biesheuvel , Jiewen Yao , Jordan Justen , Gerd Hoffmann References: <20211108162208.15028-1-michael.d.kinney@intel.com> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= In-Reply-To: <20211108162208.15028-1-michael.d.kinney@intel.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 > Cc: Julien Grall > Cc: Ard Biesheuvel > Cc: Jiewen Yao > Cc: Jordan Justen > Cc: Gerd Hoffmann > Signed-off-by: Michael D Kinney > --- > .../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?