Reviewed-by: Bret Barkelew - Bret ________________________________ From: devel@edk2.groups.io on behalf of GuoMinJ via Groups.Io Sent: Tuesday, February 18, 2020 6:34:49 PM To: devel@edk2.groups.io Cc: GuoMinJ 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&data=02%7C01%7Cbret.barkelew%40microsoft.com%7Cc3d0da979cc14c97e3ab08d7b4e4b9d0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637176766775311376&sdata=eRhhSwb6DcYF9%2B%2BTnCe0wzBPvRHTgl0Ue%2BRZ7LCYtxU%3D&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 --- 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