public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] UnitTestFrameworkPkg: Invalid index may be used.
@ 2020-02-20  1:41 GuoMinJ
  2020-02-20 21:39 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
  2020-03-04  7:59 ` Zhang, Shenglei
  0 siblings, 2 replies; 6+ messages in thread
From: GuoMinJ @ 2020-02-20  1:41 UTC (permalink / raw)
  To: devel; +Cc: GuoMinJ

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2535

The UINT_TEST_STATUS and FAILURE_TYPE have used 0 as status, so use 0 as
unknown is confused, remove it from array enumeration but keep it
location in the array.

Signed-off-by: GuoMinJ <newexplorerj@gmail.com>
---
 .../Library/UnitTestResultReportLib/UnitTestResultReportLib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLib.c b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLib.c
index 687a04f55d..eba68e330c 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLib.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLib.c
@@ -65,7 +65,7 @@ GetStringForUnitTestStatus (
 {
   UINTN  Index;
 
-  for (Index = 0; Index < ARRAY_SIZE (mStatusStrings); Index++) {
+  for (Index = 0; Index < ARRAY_SIZE (mStatusStrings) - 1; Index++) {
     if (mStatusStrings[Index].Status == Status) {
       //
       // Return string from matching entry
@@ -87,7 +87,7 @@ GetStringForFailureType (
 {
   UINTN  Index;
 
-  for (Index = 0; Index < ARRAY_SIZE (mFailureTypeStrings); Index++) {
+  for (Index = 0; Index < ARRAY_SIZE (mFailureTypeStrings) - 1; Index++) {
     if (mFailureTypeStrings[Index].Type == Failure) {
       //
       // Return string from matching entry
-- 
2.17.1


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

* Re: [EXTERNAL] [edk2-devel] [PATCH] UnitTestFrameworkPkg: Invalid index may be used.
  2020-02-20  1:41 [PATCH] UnitTestFrameworkPkg: Invalid index may be used GuoMinJ
@ 2020-02-20 21:39 ` Bret Barkelew
  2020-03-04  7:59 ` Zhang, Shenglei
  1 sibling, 0 replies; 6+ messages in thread
From: Bret Barkelew @ 2020-02-20 21:39 UTC (permalink / raw)
  To: devel@edk2.groups.io, newexplorerj@gmail.com; +Cc: GuoMinJ

[-- Attachment #1: Type: text/plain, Size: 2198 bytes --]

Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>

- Bret

________________________________
From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of GuoMinJ via Groups.Io <newexplorerj=gmail.com@groups.io>
Sent: Wednesday, February 19, 2020 5:41:56 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: GuoMinJ <newexplorerj@gmail.com>
Subject: [EXTERNAL] [edk2-devel] [PATCH] UnitTestFrameworkPkg: Invalid index may be used.

REF: https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2535&amp;data=02%7C01%7CBret.Barkelew%40microsoft.com%7C49deda8899264bfbb32108d7b5a66f87%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637177598752484898&amp;sdata=WySGg%2BbeLnDDt98xRUOhjGd1DkNyU5m8HiRInsVKm4Q%3D&amp;reserved=0

The UINT_TEST_STATUS and FAILURE_TYPE have used 0 as status, so use 0 as
unknown is confused, remove it from array enumeration but keep it
location in the array.

Signed-off-by: GuoMinJ <newexplorerj@gmail.com>
---
 .../Library/UnitTestResultReportLib/UnitTestResultReportLib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLib.c b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLib.c
index 687a04f55d..eba68e330c 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLib.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLib.c
@@ -65,7 +65,7 @@ GetStringForUnitTestStatus (
 {
   UINTN  Index;

-  for (Index = 0; Index < ARRAY_SIZE (mStatusStrings); Index++) {
+  for (Index = 0; Index < ARRAY_SIZE (mStatusStrings) - 1; Index++) {
     if (mStatusStrings[Index].Status == Status) {
       //
       // Return string from matching entry
@@ -87,7 +87,7 @@ GetStringForFailureType (
 {
   UINTN  Index;

-  for (Index = 0; Index < ARRAY_SIZE (mFailureTypeStrings); Index++) {
+  for (Index = 0; Index < ARRAY_SIZE (mFailureTypeStrings) - 1; Index++) {
     if (mFailureTypeStrings[Index].Type == Failure) {
       //
       // Return string from matching entry
--
2.17.1





[-- Attachment #2: Type: text/html, Size: 4707 bytes --]

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

* Re: [edk2-devel] [PATCH] UnitTestFrameworkPkg: Invalid index may be used.
  2020-02-20  1:41 [PATCH] UnitTestFrameworkPkg: Invalid index may be used GuoMinJ
  2020-02-20 21:39 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
@ 2020-03-04  7:59 ` Zhang, Shenglei
  2020-03-23  5:56   ` Guomin Jiang
  1 sibling, 1 reply; 6+ messages in thread
From: Zhang, Shenglei @ 2020-03-04  7:59 UTC (permalink / raw)
  To: devel@edk2.groups.io, newexplorerj@gmail.com

Reviewed-by: Shenglei Zhang <shenglei.zhang@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> GuoMinJ
> Sent: Thursday, February 20, 2020 9:42 AM
> To: devel@edk2.groups.io
> Cc: GuoMinJ <newexplorerj@gmail.com>
> Subject: [edk2-devel] [PATCH] UnitTestFrameworkPkg: Invalid index may be
> used.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2535
> 
> The UINT_TEST_STATUS and FAILURE_TYPE have used 0 as status, so use 0 as
> unknown is confused, remove it from array enumeration but keep it
> location in the array.
> 
> Signed-off-by: GuoMinJ <newexplorerj@gmail.com>
> ---
>  .../Library/UnitTestResultReportLib/UnitTestResultReportLib.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git
> a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultR
> eportLib.c
> b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultR
> eportLib.c
> index 687a04f55d..eba68e330c 100644
> ---
> a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultR
> eportLib.c
> +++
> b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultR
> eportLib.c
> @@ -65,7 +65,7 @@ GetStringForUnitTestStatus (
>  {
>    UINTN  Index;
> 
> -  for (Index = 0; Index < ARRAY_SIZE (mStatusStrings); Index++) {
> +  for (Index = 0; Index < ARRAY_SIZE (mStatusStrings) - 1; Index++) {
>      if (mStatusStrings[Index].Status == Status) {
>        //
>        // Return string from matching entry
> @@ -87,7 +87,7 @@ GetStringForFailureType (
>  {
>    UINTN  Index;
> 
> -  for (Index = 0; Index < ARRAY_SIZE (mFailureTypeStrings); Index++) {
> +  for (Index = 0; Index < ARRAY_SIZE (mFailureTypeStrings) - 1; Index++) {
>      if (mFailureTypeStrings[Index].Type == Failure) {
>        //
>        // Return string from matching entry
> --
> 2.17.1
> 
> 
> 


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

* Re: [edk2-devel] [PATCH] UnitTestFrameworkPkg: Invalid index may be used.
  2020-03-04  7:59 ` Zhang, Shenglei
@ 2020-03-23  5:56   ` Guomin Jiang
  2020-03-23 17:32     ` Michael D Kinney
  0 siblings, 1 reply; 6+ messages in thread
From: Guomin Jiang @ 2020-03-23  5:56 UTC (permalink / raw)
  To: devel@edk2.groups.io, Zhang, Shenglei, newexplorerj@gmail.com
  Cc: Kinney, Michael D, sean.brogan@microsoft.com,
	Bret.Barkelew@microsoft.com

Hi Michael, Sean, Bret,

Could help review the patch?

Thanks
> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Zhang, Shenglei
> Sent: Wednesday, March 4, 2020 3:59 PM
> To: devel@edk2.groups.io; newexplorerj@gmail.com
> Subject: Re: [edk2-devel] [PATCH] UnitTestFrameworkPkg: Invalid index may
> be used.
> 
> Reviewed-by: Shenglei Zhang <shenglei.zhang@intel.com>
> 
> > -----Original Message-----
> > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> > GuoMinJ
> > Sent: Thursday, February 20, 2020 9:42 AM
> > To: devel@edk2.groups.io
> > Cc: GuoMinJ <newexplorerj@gmail.com>
> > Subject: [edk2-devel] [PATCH] UnitTestFrameworkPkg: Invalid index may
> > be used.
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2535
> >
> > The UINT_TEST_STATUS and FAILURE_TYPE have used 0 as status, so use 0
> > as unknown is confused, remove it from array enumeration but keep it
> > location in the array.
> >
> > Signed-off-by: GuoMinJ <newexplorerj@gmail.com>
> > ---
> >  .../Library/UnitTestResultReportLib/UnitTestResultReportLib.c | 4
> > ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git
> >
> a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultR
> > eportLib.c
> >
> b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultR
> > eportLib.c
> > index 687a04f55d..eba68e330c 100644
> > ---
> >
> a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultR
> > eportLib.c
> > +++
> >
> b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultR
> > eportLib.c
> > @@ -65,7 +65,7 @@ GetStringForUnitTestStatus (  {
> >    UINTN  Index;
> >
> > -  for (Index = 0; Index < ARRAY_SIZE (mStatusStrings); Index++) {
> > +  for (Index = 0; Index < ARRAY_SIZE (mStatusStrings) - 1; Index++) {
> >      if (mStatusStrings[Index].Status == Status) {
> >        //
> >        // Return string from matching entry @@ -87,7 +87,7 @@
> > GetStringForFailureType (  {
> >    UINTN  Index;
> >
> > -  for (Index = 0; Index < ARRAY_SIZE (mFailureTypeStrings); Index++)
> > {
> > +  for (Index = 0; Index < ARRAY_SIZE (mFailureTypeStrings) - 1;
> > + Index++) {
> >      if (mFailureTypeStrings[Index].Type == Failure) {
> >        //
> >        // Return string from matching entry
> > --
> > 2.17.1
> >
> >
> >
> 
> 
> 


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

* Re: [edk2-devel] [PATCH] UnitTestFrameworkPkg: Invalid index may be used.
  2020-03-23  5:56   ` Guomin Jiang
@ 2020-03-23 17:32     ` Michael D Kinney
  2020-03-24 17:17       ` Bret Barkelew
  0 siblings, 1 reply; 6+ messages in thread
From: Michael D Kinney @ 2020-03-23 17:32 UTC (permalink / raw)
  To: Jiang, Guomin, devel@edk2.groups.io, Zhang, Shenglei,
	newexplorerj@gmail.com, Kinney, Michael D
  Cc: sean.brogan@microsoft.com, Bret.Barkelew@microsoft.com

Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>

Mike

> -----Original Message-----
> From: Jiang, Guomin <guomin.jiang@intel.com>
> Sent: Sunday, March 22, 2020 10:56 PM
> To: devel@edk2.groups.io; Zhang, Shenglei
> <shenglei.zhang@intel.com>; newexplorerj@gmail.com
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>;
> sean.brogan@microsoft.com; Bret.Barkelew@microsoft.com
> Subject: RE: [edk2-devel] [PATCH] UnitTestFrameworkPkg:
> Invalid index may be used.
> 
> Hi Michael, Sean, Bret,
> 
> Could help review the patch?
> 
> Thanks
> > -----Original Message-----
> > From: devel@edk2.groups.io
> [mailto:devel@edk2.groups.io] On Behalf Of
> > Zhang, Shenglei
> > Sent: Wednesday, March 4, 2020 3:59 PM
> > To: devel@edk2.groups.io; newexplorerj@gmail.com
> > Subject: Re: [edk2-devel] [PATCH]
> UnitTestFrameworkPkg: Invalid index may
> > be used.
> >
> > Reviewed-by: Shenglei Zhang
> <shenglei.zhang@intel.com>
> >
> > > -----Original Message-----
> > > From: devel@edk2.groups.io
> [mailto:devel@edk2.groups.io] On Behalf Of
> > > GuoMinJ
> > > Sent: Thursday, February 20, 2020 9:42 AM
> > > To: devel@edk2.groups.io
> > > Cc: GuoMinJ <newexplorerj@gmail.com>
> > > Subject: [edk2-devel] [PATCH] UnitTestFrameworkPkg:
> Invalid index may
> > > be used.
> > >
> > > REF:
> https://bugzilla.tianocore.org/show_bug.cgi?id=2535
> > >
> > > The UINT_TEST_STATUS and FAILURE_TYPE have used 0
> as status, so use 0
> > > as unknown is confused, remove it from array
> enumeration but keep it
> > > location in the array.
> > >
> > > Signed-off-by: GuoMinJ <newexplorerj@gmail.com>
> > > ---
> > >
> .../Library/UnitTestResultReportLib/UnitTestResultRepor
> tLib.c | 4
> > > ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git
> > >
> >
> a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/
> UnitTestResultR
> > > eportLib.c
> > >
> >
> b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/
> UnitTestResultR
> > > eportLib.c
> > > index 687a04f55d..eba68e330c 100644
> > > ---
> > >
> >
> a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/
> UnitTestResultR
> > > eportLib.c
> > > +++
> > >
> >
> b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/
> UnitTestResultR
> > > eportLib.c
> > > @@ -65,7 +65,7 @@ GetStringForUnitTestStatus (  {
> > >    UINTN  Index;
> > >
> > > -  for (Index = 0; Index < ARRAY_SIZE
> (mStatusStrings); Index++) {
> > > +  for (Index = 0; Index < ARRAY_SIZE
> (mStatusStrings) - 1; Index++) {
> > >      if (mStatusStrings[Index].Status == Status) {
> > >        //
> > >        // Return string from matching entry @@ -
> 87,7 +87,7 @@
> > > GetStringForFailureType (  {
> > >    UINTN  Index;
> > >
> > > -  for (Index = 0; Index < ARRAY_SIZE
> (mFailureTypeStrings); Index++)
> > > {
> > > +  for (Index = 0; Index < ARRAY_SIZE
> (mFailureTypeStrings) - 1;
> > > + Index++) {
> > >      if (mFailureTypeStrings[Index].Type ==
> Failure) {
> > >        //
> > >        // Return string from matching entry
> > > --
> > > 2.17.1
> > >
> > >
> > >
> >
> >
> > 


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

* Re: [edk2-devel] [PATCH] UnitTestFrameworkPkg: Invalid index may be used.
  2020-03-23 17:32     ` Michael D Kinney
@ 2020-03-24 17:17       ` Bret Barkelew
  0 siblings, 0 replies; 6+ messages in thread
From: Bret Barkelew @ 2020-03-24 17:17 UTC (permalink / raw)
  To: devel@edk2.groups.io, Kinney, Michael D, Jiang, Guomin,
	Zhang, Shenglei, newexplorerj@gmail.com
  Cc: Sean Brogan

[-- Attachment #1: Type: text/plain, Size: 4158 bytes --]

Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>

- Bret

________________________________
From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Michael D Kinney via Groups.Io <michael.d.kinney=intel.com@groups.io>
Sent: Monday, March 23, 2020 10:32:59 AM
To: Jiang, Guomin <guomin.jiang@intel.com>; devel@edk2.groups.io <devel@edk2.groups.io>; Zhang, Shenglei <shenglei.zhang@intel.com>; newexplorerj@gmail.com <newexplorerj@gmail.com>; Kinney, Michael D <michael.d.kinney@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH] UnitTestFrameworkPkg: Invalid index may be used.

Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>

Mike

> -----Original Message-----
> From: Jiang, Guomin <guomin.jiang@intel.com>
> Sent: Sunday, March 22, 2020 10:56 PM
> To: devel@edk2.groups.io; Zhang, Shenglei
> <shenglei.zhang@intel.com>; newexplorerj@gmail.com
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>;
> sean.brogan@microsoft.com; Bret.Barkelew@microsoft.com
> Subject: RE: [edk2-devel] [PATCH] UnitTestFrameworkPkg:
> Invalid index may be used.
>
> Hi Michael, Sean, Bret,
>
> Could help review the patch?
>
> Thanks
> > -----Original Message-----
> > From: devel@edk2.groups.io
> [mailto:devel@edk2.groups.io] On Behalf Of
> > Zhang, Shenglei
> > Sent: Wednesday, March 4, 2020 3:59 PM
> > To: devel@edk2.groups.io; newexplorerj@gmail.com
> > Subject: Re: [edk2-devel] [PATCH]
> UnitTestFrameworkPkg: Invalid index may
> > be used.
> >
> > Reviewed-by: Shenglei Zhang
> <shenglei.zhang@intel.com>
> >
> > > -----Original Message-----
> > > From: devel@edk2.groups.io
> [mailto:devel@edk2.groups.io] On Behalf Of
> > > GuoMinJ
> > > Sent: Thursday, February 20, 2020 9:42 AM
> > > To: devel@edk2.groups.io
> > > Cc: GuoMinJ <newexplorerj@gmail.com>
> > > Subject: [edk2-devel] [PATCH] UnitTestFrameworkPkg:
> Invalid index may
> > > be used.
> > >
> > > REF:
> https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2535&amp;data=02%7C01%7CBret.Barkelew%40microsoft.com%7C6e119160718c41dd8bea08d7cf503d05%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637205815839534686&amp;sdata=G5r02YNEXW3PG%2BJUsOg9A5BrKdqpkdlJHceyK4Gkd1Y%3D&amp;reserved=0
> > >
> > > The UINT_TEST_STATUS and FAILURE_TYPE have used 0
> as status, so use 0
> > > as unknown is confused, remove it from array
> enumeration but keep it
> > > location in the array.
> > >
> > > Signed-off-by: GuoMinJ <newexplorerj@gmail.com>
> > > ---
> > >
> .../Library/UnitTestResultReportLib/UnitTestResultRepor
> tLib.c | 4
> > > ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git
> > >
> >
> a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/
> UnitTestResultR
> > > eportLib.c
> > >
> >
> b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/
> UnitTestResultR
> > > eportLib.c
> > > index 687a04f55d..eba68e330c 100644
> > > ---
> > >
> >
> a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/
> UnitTestResultR
> > > eportLib.c
> > > +++
> > >
> >
> b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/
> UnitTestResultR
> > > eportLib.c
> > > @@ -65,7 +65,7 @@ GetStringForUnitTestStatus (  {
> > >    UINTN  Index;
> > >
> > > -  for (Index = 0; Index < ARRAY_SIZE
> (mStatusStrings); Index++) {
> > > +  for (Index = 0; Index < ARRAY_SIZE
> (mStatusStrings) - 1; Index++) {
> > >      if (mStatusStrings[Index].Status == Status) {
> > >        //
> > >        // Return string from matching entry @@ -
> 87,7 +87,7 @@
> > > GetStringForFailureType (  {
> > >    UINTN  Index;
> > >
> > > -  for (Index = 0; Index < ARRAY_SIZE
> (mFailureTypeStrings); Index++)
> > > {
> > > +  for (Index = 0; Index < ARRAY_SIZE
> (mFailureTypeStrings) - 1;
> > > + Index++) {
> > >      if (mFailureTypeStrings[Index].Type ==
> Failure) {
> > >        //
> > >        // Return string from matching entry
> > > --
> > > 2.17.1
> > >
> > >
> > >
> >
> >
> >





[-- Attachment #2: Type: text/html, Size: 7894 bytes --]

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

end of thread, other threads:[~2020-03-24 17:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-20  1:41 [PATCH] UnitTestFrameworkPkg: Invalid index may be used GuoMinJ
2020-02-20 21:39 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
2020-03-04  7:59 ` Zhang, Shenglei
2020-03-23  5:56   ` Guomin Jiang
2020-03-23 17:32     ` Michael D Kinney
2020-03-24 17:17       ` Bret Barkelew

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