From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web10.47361.1584943711440601561 for ; Sun, 22 Mar 2020 23:08:31 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: guomin.jiang@intel.com) IronPort-SDR: o2NxAUtdnfuZFr0rKXDqmLpe5T+s9QVBAutWIA3nBcg548wqfoiZ1J+7Rchvtc338MMvo4eA0K fBylCYw8Sovg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2020 23:08:30 -0700 IronPort-SDR: UwI96VWuFGeEffSOB0l4SGsJn0F3XUXanQvdr9Nap+cilAWK/LkEgx6fSZ+utZUg9Pwet65L1l fhZ1wMBZlczg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,295,1580803200"; d="scan'208";a="246094085" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga003.jf.intel.com with ESMTP; 22 Mar 2020 23:08:30 -0700 Received: from fmsmsx605.amr.corp.intel.com (10.18.126.85) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 22 Mar 2020 23:08:30 -0700 Received: from fmsmsx605.amr.corp.intel.com (10.18.126.85) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Sun, 22 Mar 2020 23:08:29 -0700 Received: from shsmsx154.ccr.corp.intel.com (10.239.6.54) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Sun, 22 Mar 2020 23:08:29 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.43]) by SHSMSX154.ccr.corp.intel.com ([169.254.7.145]) with mapi id 14.03.0439.000; Mon, 23 Mar 2020 14:08:27 +0800 From: "Guomin Jiang" To: "devel@edk2.groups.io" , "Zhang, Shenglei" , "newexplorerj@gmail.com" CC: "Kinney, Michael D" , Sean Brogan , Bret Barkelew Subject: Re: [edk2-devel] [PATCH v2] UnitTestFrameworkPkg/UnitTestLib: Check Suite pointer before use. Thread-Topic: [edk2-devel] [PATCH v2] UnitTestFrameworkPkg/UnitTestLib: Check Suite pointer before use. Thread-Index: AQHV8rYFRJrw0nn8bEKDV3piuWkc66hD/BYAgBHQ4uA= Date: Mon, 23 Mar 2020 06:08:27 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: guomin.jiang@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Michael, Sean, Bret, Could you review the patch? Thanks > -----Original Message----- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > Zhang, Shenglei > Sent: Thursday, March 12, 2020 2:02 PM > To: devel@edk2.groups.io; newexplorerj@gmail.com > Cc: Kinney, Michael D ; Sean Brogan > ; Bret Barkelew > > Subject: Re: [edk2-devel] [PATCH v2] UnitTestFrameworkPkg/UnitTestLib: > Check Suite pointer before use. >=20 > Reviewed-by: Shenglei Zhang >=20 > > -----Original Message----- > > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > > GuoMinJ > > Sent: Thursday, March 5, 2020 2:18 PM > > To: devel@edk2.groups.io > > Cc: GuoMinJ ; Kinney, Michael D > > ; Sean Brogan > ; > > Bret Barkelew > > Subject: [edk2-devel] [PATCH v2] UnitTestFrameworkPkg/UnitTestLib: > > Check Suite pointer before use. > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2530 > > > > The Suite pointer is used before check if it is valid, correct it to > > check the validation before use. > > > > Cc: Michael D Kinney > > Cc: Sean Brogan > > Cc: Bret Barkelew > > Signed-off-by: GuoMinJ > > --- > > UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c | 6 +++--- > > UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c | 2 +- > > 2 files changed, 4 insertions(+), 4 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 =3D NULL; > > - ParentFramework =3D (UNIT_TEST_FRAMEWORK *)Suite- > >ParentFramework; > > - > > if (Suite =3D=3D NULL) { > > return EFI_INVALID_PARAMETER; > > } > > > > + TestEntry =3D NULL; > > + ParentFramework =3D (UNIT_TEST_FRAMEWORK *)Suite- > > >ParentFramework; > > + > > DEBUG ((DEBUG_VERBOSE, > > "-------------------------------------------------------- > > -\n")); > > DEBUG ((DEBUG_VERBOSE, "RUNNING TEST SUITE: %a\n", Suite->Title)); > > DEBUG ((DEBUG_VERBOSE, > > "-------------------------------------------------------- > > -\n")); > > diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c > > b/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c > > index fd15991ea4..b136992d99 100644 > > --- a/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c > > +++ b/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c > > @@ -436,7 +436,6 @@ AddTestCase ( > > > > Status =3D EFI_SUCCESS; > > Suite =3D (UNIT_TEST_SUITE *)SuiteHandle; > > - ParentFramework =3D (UNIT_TEST_FRAMEWORK *)Suite- > >ParentFramework; > > > > // > > // First, let's check to make sure that our parameters look good. > > @@ -445,6 +444,7 @@ AddTestCase ( > > return EFI_INVALID_PARAMETER; > > } > > > > + ParentFramework =3D (UNIT_TEST_FRAMEWORK *)Suite- > > >ParentFramework; > > // > > // Create the new entry. > > NewTestEntry =3D AllocateZeroPool (sizeof( UNIT_TEST_LIST_ENTRY )); > > -- > > 2.17.1 > > > > > > >=20 >=20 >=20