public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] UnitTestFrameworkPkg: Suspicious check for pointer Suite
@ 2020-02-19  2:34 GuoMinJ
  2020-02-20  2:42 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
  2020-03-04  7:58 ` Zhang, Shenglei
  0 siblings, 2 replies; 3+ messages in thread
From: GuoMinJ @ 2020-02-19  2:34 UTC (permalink / raw)
  To: devel; +Cc: GuoMinJ

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

The Suite pointer is used before check if it is valid,
correct it to check the validation before use.

Signed-off-by: GuoMinJ <newexplorerj@gmail.com>
---
 UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c b/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c
index fb247c59e7..b053e04959 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c
@@ -33,13 +33,13 @@ RunTestSuite (
   UNIT_TEST             *Test;
   UNIT_TEST_FRAMEWORK   *ParentFramework;
 
-  TestEntry       = NULL;
-  ParentFramework = (UNIT_TEST_FRAMEWORK *)Suite->ParentFramework;
-
   if (Suite == NULL) {
     return EFI_INVALID_PARAMETER;
   }
 
+  TestEntry       = NULL;
+  ParentFramework = (UNIT_TEST_FRAMEWORK *)Suite->ParentFramework;
+
   DEBUG ((DEBUG_VERBOSE, "---------------------------------------------------------\n"));
   DEBUG ((DEBUG_VERBOSE, "RUNNING TEST SUITE: %a\n", Suite->Title));
   DEBUG ((DEBUG_VERBOSE, "---------------------------------------------------------\n"));
-- 
2.17.1


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

* Re: [EXTERNAL] [edk2-devel] [PATCH] UnitTestFrameworkPkg: Suspicious check for pointer Suite
  2020-02-19  2:34 [PATCH] UnitTestFrameworkPkg: Suspicious check for pointer Suite GuoMinJ
@ 2020-02-20  2:42 ` Bret Barkelew
  2020-03-04  7:58 ` Zhang, Shenglei
  1 sibling, 0 replies; 3+ messages in thread
From: Bret Barkelew @ 2020-02-20  2:42 UTC (permalink / raw)
  To: devel@edk2.groups.io, newexplorerj@gmail.com; +Cc: GuoMinJ

[-- Attachment #1: Type: text/plain, Size: 2019 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: Tuesday, February 18, 2020 6:34:49 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: GuoMinJ <newexplorerj@gmail.com>
Subject: [EXTERNAL] [edk2-devel] [PATCH] UnitTestFrameworkPkg: Suspicious check for pointer Suite

REF: https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2530&amp;data=02%7C01%7Cbret.barkelew%40microsoft.com%7Cc3d0da979cc14c97e3ab08d7b4e4b9d0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637176766775311376&amp;sdata=eRhhSwb6DcYF9%2B%2BTnCe0wzBPvRHTgl0Ue%2BRZ7LCYtxU%3D&amp;reserved=0

The Suite pointer is used before check if it is valid,
correct it to check the validation before use.

Signed-off-by: GuoMinJ <newexplorerj@gmail.com>
---
 UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c b/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c
index fb247c59e7..b053e04959 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c
@@ -33,13 +33,13 @@ RunTestSuite (
   UNIT_TEST             *Test;
   UNIT_TEST_FRAMEWORK   *ParentFramework;

-  TestEntry       = NULL;
-  ParentFramework = (UNIT_TEST_FRAMEWORK *)Suite->ParentFramework;
-
   if (Suite == NULL) {
     return EFI_INVALID_PARAMETER;
   }

+  TestEntry       = NULL;
+  ParentFramework = (UNIT_TEST_FRAMEWORK *)Suite->ParentFramework;
+
   DEBUG ((DEBUG_VERBOSE, "---------------------------------------------------------\n"));
   DEBUG ((DEBUG_VERBOSE, "RUNNING TEST SUITE: %a\n", Suite->Title));
   DEBUG ((DEBUG_VERBOSE, "---------------------------------------------------------\n"));
--
2.17.1





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

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

* Re: [edk2-devel] [PATCH] UnitTestFrameworkPkg: Suspicious check for pointer Suite
  2020-02-19  2:34 [PATCH] UnitTestFrameworkPkg: Suspicious check for pointer Suite GuoMinJ
  2020-02-20  2:42 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
@ 2020-03-04  7:58 ` Zhang, Shenglei
  1 sibling, 0 replies; 3+ messages in thread
From: Zhang, Shenglei @ 2020-03-04  7:58 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: Wednesday, February 19, 2020 10:35 AM
> To: devel@edk2.groups.io
> Cc: GuoMinJ <newexplorerj@gmail.com>
> Subject: [edk2-devel] [PATCH] UnitTestFrameworkPkg: Suspicious check for
> pointer Suite
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2530
> 
> The Suite pointer is used before check if it is valid,
> correct it to check the validation before use.
> 
> Signed-off-by: GuoMinJ <newexplorerj@gmail.com>
> ---
>  UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c
> b/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c
> index fb247c59e7..b053e04959 100644
> --- a/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c
> +++ b/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c
> @@ -33,13 +33,13 @@ RunTestSuite (
>    UNIT_TEST             *Test;
>    UNIT_TEST_FRAMEWORK   *ParentFramework;
> 
> -  TestEntry       = NULL;
> -  ParentFramework = (UNIT_TEST_FRAMEWORK *)Suite->ParentFramework;
> -
>    if (Suite == NULL) {
>      return EFI_INVALID_PARAMETER;
>    }
> 
> +  TestEntry       = NULL;
> +  ParentFramework = (UNIT_TEST_FRAMEWORK *)Suite-
> >ParentFramework;
> +
>    DEBUG ((DEBUG_VERBOSE, "--------------------------------------------------------
> -\n"));
>    DEBUG ((DEBUG_VERBOSE, "RUNNING TEST SUITE: %a\n", Suite->Title));
>    DEBUG ((DEBUG_VERBOSE, "--------------------------------------------------------
> -\n"));
> --
> 2.17.1
> 
> 
> 


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

end of thread, other threads:[~2020-03-04  7:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-19  2:34 [PATCH] UnitTestFrameworkPkg: Suspicious check for pointer Suite GuoMinJ
2020-02-20  2:42 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
2020-03-04  7:58 ` Zhang, Shenglei

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