public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: devel@edk2.groups.io, michael.d.kinney@intel.com
Cc: Anthony Perard <anthony.perard@citrix.com>,
	Julien Grall <julien@xen.org>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Jiewen Yao <jiewen.yao@intel.com>,
	Jordan Justen <jordan.l.justen@intel.com>,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [edk2-devel] [Patch 1/1] OvmfPkg/Xen: Fix VS2019 build issues
Date: Thu, 11 Nov 2021 11:24:06 +0100	[thread overview]
Message-ID: <5ab0569c-d9e9-a4a2-dae2-a80dba9a164c@redhat.com> (raw)
In-Reply-To: <20211108162208.15028-1-michael.d.kinney@intel.com>

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.perard@citrix.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@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?


  parent reply	other threads:[~2021-11-11 10:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-08 16:22 [Patch 1/1] OvmfPkg/Xen: Fix VS2019 build issues Michael D Kinney
2021-11-09  7:01 ` Gerd Hoffmann
2021-11-11  4:02   ` Yao, Jiewen
2021-11-11 10:24 ` Philippe Mathieu-Daudé [this message]
2021-11-11 19:45   ` [edk2-devel] " Michael D Kinney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5ab0569c-d9e9-a4a2-dae2-a80dba9a164c@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox