public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Guomin Jiang" <guomin.jiang@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Zhang, Shenglei" <shenglei.zhang@intel.com>,
	"newexplorerj@gmail.com" <newexplorerj@gmail.com>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>,
	Sean Brogan <sean.brogan@microsoft.com>,
	Bret Barkelew <Bret.Barkelew@microsoft.com>
Subject: Re: [edk2-devel] [PATCH v2] UnitTestFrameworkPkg/UnitTestLib: Check Suite pointer before use.
Date: Mon, 23 Mar 2020 06:08:27 +0000	[thread overview]
Message-ID: <B1F5B0856690F44595CF70FED755C939549461@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <C0706E73DB8C124D9B9C38AA364E5D5E0604481E@SHSMSX104.ccr.corp.intel.com>

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 <michael.d.kinney@intel.com>; Sean Brogan
> <sean.brogan@microsoft.com>; Bret Barkelew
> <Bret.Barkelew@microsoft.com>
> Subject: Re: [edk2-devel] [PATCH v2] UnitTestFrameworkPkg/UnitTestLib:
> Check Suite pointer before use.
> 
> 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: Thursday, March 5, 2020 2:18 PM
> > To: devel@edk2.groups.io
> > Cc: GuoMinJ <newexplorerj@gmail.com>; Kinney, Michael D
> > <michael.d.kinney@intel.com>; Sean Brogan
> <sean.brogan@microsoft.com>;
> > Bret Barkelew <Bret.Barkelew@microsoft.com>
> > Subject: [edk2-devel] [PATCH v2] UnitTestFrameworkPkg/UnitTestLib:
> > Check Suite pointer before use.
> >
> > 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.
> >
> > Cc: Michael D Kinney <michael.d.kinney@intel.com>
> > Cc: Sean Brogan <sean.brogan@microsoft.com>
> > Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
> > Signed-off-by: GuoMinJ <newexplorerj@gmail.com>
> > ---
> >  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       = 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"));
> > 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          = EFI_SUCCESS;
> >    Suite           = (UNIT_TEST_SUITE *)SuiteHandle;
> > -  ParentFramework = (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 = (UNIT_TEST_FRAMEWORK *)Suite-
> > >ParentFramework;
> >    //
> >    // Create the new entry.
> >    NewTestEntry = AllocateZeroPool (sizeof( UNIT_TEST_LIST_ENTRY ));
> > --
> > 2.17.1
> >
> >
> >
> 
> 
> 


  reply	other threads:[~2020-03-23  6:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05  6:17 [PATCH v2] UnitTestFrameworkPkg/UnitTestLib: Check Suite pointer before use GuoMinJ
2020-03-12  6:02 ` [edk2-devel] " Zhang, Shenglei
2020-03-23  6:08   ` Guomin Jiang [this message]
2020-03-23 18:00     ` Michael D Kinney
2020-03-23 21:54       ` Bret Barkelew

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B1F5B0856690F44595CF70FED755C939549461@SHSMSX101.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox