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

- Bret

________________________________
From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of GuoMinJ via 
Groups.Io <newexplorerj=gmail....@groups.io>
Sent: Tuesday, February 18, 2020 6:34:49 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: GuoMinJ <newexplor...@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 <newexplor...@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





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#54662): https://edk2.groups.io/g/devel/message/54662
Mute This Topic: https://groups.io/mt/71412862/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to