public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 1/1] EmbeddedPkg: Fixed Asserts in SCT Runtime Services test.
@ 2020-02-18 12:23 Gaurav Jain
  2020-02-19  9:05 ` [edk2-devel] " Liming Gao
  2020-02-26 12:35 ` Gaurav Jain
  0 siblings, 2 replies; 5+ messages in thread
From: Gaurav Jain @ 2020-02-18 12:23 UTC (permalink / raw)
  To: devel; +Cc: Leif Lindholm, Ard Biesheuvel, Pankaj Bansal, Gaurav Jain

ASSERT in SetTime_Conf and SetWakeupTime_Conf Consistency Test.
SCT Test expect return as Invalid Parameter.
So removed ASSERT().

Added Time Validity Checks in SetWakeupTime.

Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
---
Changes in v2:
  - reverted changes related to valid range of years.
---
 EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c b/EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c
index 08fb9b0100b6..70a0d78125b9 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)) {
@@ -113,6 +109,7 @@ IsTimeValid(
       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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] [PATCH v2 1/1] EmbeddedPkg: Fixed Asserts in SCT Runtime Services test.
  2020-02-18 12:23 [PATCH v2 1/1] EmbeddedPkg: Fixed Asserts in SCT Runtime Services test Gaurav Jain
@ 2020-02-19  9:05 ` Liming Gao
  2020-02-20  5:19   ` [EXT] " Gaurav Jain
  2020-02-26 12:35 ` Gaurav Jain
  1 sibling, 1 reply; 5+ messages in thread
From: Liming Gao @ 2020-02-19  9:05 UTC (permalink / raw)
  To: devel@edk2.groups.io, gaurav.jain@nxp.com
  Cc: Leif Lindholm, Ard Biesheuvel, Pankaj Bansal

Gaurav:
  Does this patch catch to edk2 stable tag 202002? 

Thanks
Liming
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gaurav Jain
> Sent: Tuesday, February 18, 2020 8:24 PM
> To: devel@edk2.groups.io
> Cc: Leif Lindholm <leif@nuviainc.com>; Ard Biesheuvel <ard.biesheuvel@linaro.org>; Pankaj Bansal <pankaj.bansal@nxp.com>; Gaurav
> Jain <gaurav.jain@nxp.com>
> Subject: [edk2-devel] [PATCH v2 1/1] EmbeddedPkg: Fixed Asserts in SCT Runtime Services test.
> 
> ASSERT in SetTime_Conf and SetWakeupTime_Conf Consistency Test.
> SCT Test expect return as Invalid Parameter.
> So removed ASSERT().
> 
> Added Time Validity Checks in SetWakeupTime.
> 
> Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
> ---
> Changes in v2:
>   - reverted changes related to valid range of years.
> ---
>  EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c b/EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c
> index 08fb9b0100b6..70a0d78125b9 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)) {
> @@ -113,6 +109,7 @@ IsTimeValid(
>        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
> 
> 
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [EXT] RE: [edk2-devel] [PATCH v2 1/1] EmbeddedPkg: Fixed Asserts in SCT Runtime Services test.
  2020-02-19  9:05 ` [edk2-devel] " Liming Gao
@ 2020-02-20  5:19   ` Gaurav Jain
  2020-02-20  5:21     ` Liming Gao
  0 siblings, 1 reply; 5+ messages in thread
From: Gaurav Jain @ 2020-02-20  5:19 UTC (permalink / raw)
  To: Gao, Liming, devel@edk2.groups.io
  Cc: Leif Lindholm, Ard Biesheuvel, Pankaj Bansal

> Gaurav:
>   Does this patch catch to edk2 stable tag 202002?
Yes

Thanks
Gaurav

> -----Original Message-----
> From: Gao, Liming <liming.gao@intel.com>
> Sent: Wednesday, February 19, 2020 2:36 PM
> To: devel@edk2.groups.io; Gaurav Jain <gaurav.jain@nxp.com>
> Cc: Leif Lindholm <leif@nuviainc.com>; Ard Biesheuvel
> <ard.biesheuvel@linaro.org>; Pankaj Bansal <pankaj.bansal@nxp.com>
> Subject: [EXT] RE: [edk2-devel] [PATCH v2 1/1] EmbeddedPkg: Fixed Asserts in
> SCT Runtime Services test.
> 
> Caution: EXT Email
> 
> Gaurav:
>   Does this patch catch to edk2 stable tag 202002?
> 
> Thanks
> Liming
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gaurav
> > Jain
> > Sent: Tuesday, February 18, 2020 8:24 PM
> > To: devel@edk2.groups.io
> > Cc: Leif Lindholm <leif@nuviainc.com>; Ard Biesheuvel
> > <ard.biesheuvel@linaro.org>; Pankaj Bansal <pankaj.bansal@nxp.com>;
> > Gaurav Jain <gaurav.jain@nxp.com>
> > Subject: [edk2-devel] [PATCH v2 1/1] EmbeddedPkg: Fixed Asserts in SCT
> Runtime Services test.
> >
> > ASSERT in SetTime_Conf and SetWakeupTime_Conf Consistency Test.
> > SCT Test expect return as Invalid Parameter.
> > So removed ASSERT().
> >
> > Added Time Validity Checks in SetWakeupTime.
> >
> > Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
> > ---
> > Changes in v2:
> >   - reverted changes related to valid range of years.
> > ---
> >  EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c
> > b/EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c
> > index 08fb9b0100b6..70a0d78125b9 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)) {
> > @@ -113,6 +109,7 @@ IsTimeValid(
> >        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
> >
> >
> > 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [EXT] RE: [edk2-devel] [PATCH v2 1/1] EmbeddedPkg: Fixed Asserts in SCT Runtime Services test.
  2020-02-20  5:19   ` [EXT] " Gaurav Jain
@ 2020-02-20  5:21     ` Liming Gao
  0 siblings, 0 replies; 5+ messages in thread
From: Liming Gao @ 2020-02-20  5:21 UTC (permalink / raw)
  To: devel@edk2.groups.io, gaurav.jain@nxp.com, Leif Lindholm,
	Ard Biesheuvel
  Cc: Pankaj Bansal

Gaurav: 
  Got it. 

Lefi and Ard:
  Can you review this patch for stable tag 202002?

Thanks
Liming
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gaurav Jain
> Sent: Thursday, February 20, 2020 1:19 PM
> To: Gao, Liming <liming.gao@intel.com>; devel@edk2.groups.io
> Cc: Leif Lindholm <leif@nuviainc.com>; Ard Biesheuvel <ard.biesheuvel@linaro.org>; Pankaj Bansal <pankaj.bansal@nxp.com>
> Subject: Re: [EXT] RE: [edk2-devel] [PATCH v2 1/1] EmbeddedPkg: Fixed Asserts in SCT Runtime Services test.
> 
> > Gaurav:
> >   Does this patch catch to edk2 stable tag 202002?
> Yes
> 
> Thanks
> Gaurav
> 
> > -----Original Message-----
> > From: Gao, Liming <liming.gao@intel.com>
> > Sent: Wednesday, February 19, 2020 2:36 PM
> > To: devel@edk2.groups.io; Gaurav Jain <gaurav.jain@nxp.com>
> > Cc: Leif Lindholm <leif@nuviainc.com>; Ard Biesheuvel
> > <ard.biesheuvel@linaro.org>; Pankaj Bansal <pankaj.bansal@nxp.com>
> > Subject: [EXT] RE: [edk2-devel] [PATCH v2 1/1] EmbeddedPkg: Fixed Asserts in
> > SCT Runtime Services test.
> >
> > Caution: EXT Email
> >
> > Gaurav:
> >   Does this patch catch to edk2 stable tag 202002?
> >
> > Thanks
> > Liming
> > > -----Original Message-----
> > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gaurav
> > > Jain
> > > Sent: Tuesday, February 18, 2020 8:24 PM
> > > To: devel@edk2.groups.io
> > > Cc: Leif Lindholm <leif@nuviainc.com>; Ard Biesheuvel
> > > <ard.biesheuvel@linaro.org>; Pankaj Bansal <pankaj.bansal@nxp.com>;
> > > Gaurav Jain <gaurav.jain@nxp.com>
> > > Subject: [edk2-devel] [PATCH v2 1/1] EmbeddedPkg: Fixed Asserts in SCT
> > Runtime Services test.
> > >
> > > ASSERT in SetTime_Conf and SetWakeupTime_Conf Consistency Test.
> > > SCT Test expect return as Invalid Parameter.
> > > So removed ASSERT().
> > >
> > > Added Time Validity Checks in SetWakeupTime.
> > >
> > > Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
> > > ---
> > > Changes in v2:
> > >   - reverted changes related to valid range of years.
> > > ---
> > >  EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c | 8 ++++----
> > >  1 file changed, 4 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c
> > > b/EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c
> > > index 08fb9b0100b6..70a0d78125b9 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)) {
> > > @@ -113,6 +109,7 @@ IsTimeValid(
> > >        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
> > >
> > >
> > >
> 
> 
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] EmbeddedPkg: Fixed Asserts in SCT Runtime Services test.
  2020-02-18 12:23 [PATCH v2 1/1] EmbeddedPkg: Fixed Asserts in SCT Runtime Services test Gaurav Jain
  2020-02-19  9:05 ` [edk2-devel] " Liming Gao
@ 2020-02-26 12:35 ` Gaurav Jain
  1 sibling, 0 replies; 5+ messages in thread
From: Gaurav Jain @ 2020-02-26 12:35 UTC (permalink / raw)
  To: devel@edk2.groups.io; +Cc: Leif Lindholm, Ard Biesheuvel, Pankaj Bansal

Gentle Reminder!!
Please review..

Regards
Gaurav Jain

> -----Original Message-----
> From: Gaurav Jain <gaurav.jain@nxp.com>
> Sent: Tuesday, February 18, 2020 5:54 PM
> To: devel@edk2.groups.io
> Cc: Leif Lindholm <leif@nuviainc.com>; Ard Biesheuvel
> <ard.biesheuvel@linaro.org>; Pankaj Bansal <pankaj.bansal@nxp.com>; Gaurav
> Jain <gaurav.jain@nxp.com>
> Subject: [PATCH v2 1/1] EmbeddedPkg: Fixed Asserts in SCT Runtime Services
> test.
> 
> ASSERT in SetTime_Conf and SetWakeupTime_Conf Consistency Test.
> SCT Test expect return as Invalid Parameter.
> So removed ASSERT().
> 
> Added Time Validity Checks in SetWakeupTime.
> 
> Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
> ---
> Changes in v2:
>   - reverted changes related to valid range of years.
> ---
>  EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c
> b/EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClock.c
> index 08fb9b0100b6..70a0d78125b9 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)) { @@ -
> 113,6 +109,7 @@ IsTimeValid(
>        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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-02-26 12:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-18 12:23 [PATCH v2 1/1] EmbeddedPkg: Fixed Asserts in SCT Runtime Services test Gaurav Jain
2020-02-19  9:05 ` [edk2-devel] " Liming Gao
2020-02-20  5:19   ` [EXT] " Gaurav Jain
2020-02-20  5:21     ` Liming Gao
2020-02-26 12:35 ` Gaurav Jain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox