UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
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
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#54594): https://edk2.groups.io/g/devel/message/54594
Mute This Topic: https://groups.io/mt/71387157/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
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&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 <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 -=-=-=-=-=-=-=-=-=-=-=- 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/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
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 > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#55368): https://edk2.groups.io/g/devel/message/55368 Mute This Topic: https://groups.io/mt/71387157/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2024 Red Hat, Inc.