public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ard.biesheuvel@linaro.org>
To: Gaurav Jain <gaurav.jain@nxp.com>
Cc: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	Leif Lindholm <leif@nuviainc.com>,
	 Pankaj Bansal <pankaj.bansal@nxp.com>
Subject: Re: [PATCH 1/1] EmbeddedPkg: Fixed Asserts in SCT Runtime Services test.
Date: Thu, 30 Jan 2020 10:21:38 +0100	[thread overview]
Message-ID: <CAKv+Gu9rvFWihw2totrbbv19dAAQJ+FLKWbwz4U5u6hQ3b66ew@mail.gmail.com> (raw)
In-Reply-To: <20200130102826.20759-1-gaurav.jain@nxp.com>

On Thu, 30 Jan 2020 at 06:08, Gaurav Jain <gaurav.jain@nxp.com> wrote:
>
> ASSERT in SetTime_Conf and SetWakeupTime_Conf Consistency Test.
> SCT Test expect return as Invalid Parameter.
> So removed ASSERT().
>

This is not all this patch does.

> Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
> ---
>  EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c b/EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c
> index 08fb9b0100b6..9bfb7756f0cb 100644
> --- a/EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c
> +++ b/EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c
> @@ -85,10 +85,6 @@ IsDayValid (
>    IN  EFI_TIME  *Time
>    )
>  {
> -  ASSERT (Time->Day >= 1);
> -  ASSERT (Time->Day <= mDayOfMonth[Time->Month - 1]);
> -  ASSERT (Time->Month != 2 || IsLeapYear (Time) || Time->Day <= 28);
> -
>    if (Time->Day < 1 ||
>        Time->Day > mDayOfMonth[Time->Month - 1] ||
>        (Time->Month == 2 && !IsLeapYear (Time) && Time->Day > 28)) {
> @@ -105,14 +101,15 @@ IsTimeValid(
>    )
>  {
>    // Check the input parameters are within the range specified by UEFI
> -  if (Time->Year   < 1900               ||
> -      Time->Year   > 9999               ||
> +  if (Time->Year   < 1998               ||
> +      Time->Year   > 2099               ||

That original range is based on the UEFI spec. On what basis are you
making this change?

If your RTC hardware cannot represent the original values, this is not
the place to fix that.


>        Time->Month  < 1                  ||
>        Time->Month  > 12                 ||
>        !IsDayValid (Time)                ||
>        Time->Hour   > 23                 ||
>        Time->Minute > 59                 ||
>        Time->Second > 59                 ||
> +      Time->Nanosecond > 999999999      ||
>        !IsValidTimeZone (Time->TimeZone) ||
>        !IsValidDaylight (Time->Daylight)) {
>      return FALSE;
> @@ -254,6 +251,9 @@ SetWakeupTime (
>    OUT EFI_TIME    *Time
>    )
>  {
> +  if (Time == NULL || !IsTimeValid (Time)) {
> +    return EFI_INVALID_PARAMETER;
> +  }
>    return LibSetWakeupTime (Enabled, Time);
>  }
>
> --
> 2.17.1
>

  reply	other threads:[~2020-01-30  9:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-30  5:08 [PATCH 1/1] EmbeddedPkg: Fixed Asserts in SCT Runtime Services test Gaurav Jain
2020-01-30  9:21 ` Ard Biesheuvel [this message]
2020-01-31  8:27   ` [EXT] " gaurav.jain
2020-02-11 10:37     ` FW: " Gaurav Jain
2020-02-11 14:19       ` Ard Biesheuvel
2020-02-17  6:25         ` Gaurav Jain
2020-02-17  6:56           ` Ard Biesheuvel
2020-02-17  7:02             ` Ard Biesheuvel
  -- strict thread matches above, loose matches on Subject: below --
2020-02-17 12:51 Gaurav Jain
2020-02-17  8:31 ` Ard Biesheuvel

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=CAKv+Gu9rvFWihw2totrbbv19dAAQJ+FLKWbwz4U5u6hQ3b66ew@mail.gmail.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