From nobody Fri May 3 16:14:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+55476+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+55476+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1583389160; cv=none; d=zohomail.com; s=zohoarc; b=DnBBB7W6DLHosKSeW+J83NVBjYvroqvmQUCSSwj8fj2/XnYlSTMzJFvFVnwcLCpsUD1cPI6NysqYCtDuYO4IkesQpuJgV2x2XYjnfr2FrIjbf3HHSA9U9jB7RjZeYi6Wux4DKuDX9CjFBUBEhV+N89lRKXXI7QjSW5mnNBP6r3Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583389160; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To; bh=OxRAYUBmfeMxMouKd2rrdDzIWiiVFX0fZuajmkarwZs=; b=PPdXjuE5+AbNe5j2TsZTbJl//bD316/dizsoK1nnQec54CGnFampprWWF+8sENfTW5Sc9xWdOq6L8bAVeyH3Yt7BLw2G6Md1/q2rPmz0dO7jJyLPqAGR7shBAW7/vzS7ngzbzC3t44DCg5DYZOAydGtCgK2bGBceInQZU/QN6NA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+55476+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1583389159973876.0851998503558; Wed, 4 Mar 2020 22:19:19 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id kyQCYY1788612xGD8Nx5qENa; Wed, 04 Mar 2020 22:19:19 -0800 X-Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by mx.groups.io with SMTP id smtpd.web09.8915.1583389159144163742 for ; Wed, 04 Mar 2020 22:19:19 -0800 X-Received: by mail-pf1-f193.google.com with SMTP id z65so1744267pfz.8 for ; Wed, 04 Mar 2020 22:19:19 -0800 (PST) X-Gm-Message-State: WeGjh6q3AHtu3FI5hZ0H6KIGx1787277AA= X-Google-Smtp-Source: ADFU+vvHsAG+0srk45Qi4MgkY0JkkQt59pQdIr6lQpsAHMsYdhQkfa2ZauejYjwg6seySYp5VS56mw== X-Received: by 2002:a63:28c3:: with SMTP id o186mr6274839pgo.248.1583389158210; Wed, 04 Mar 2020 22:19:18 -0800 (PST) X-Received: from localhost.localdomain ([222.67.15.87]) by smtp.gmail.com with ESMTPSA id r13sm30203998pgf.1.2020.03.04.22.19.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2020 22:19:17 -0800 (PST) From: "GuoMinJ" To: devel@edk2.groups.io Cc: GuoMinJ , Michael D Kinney , Sean Brogan , Bret Barkelew Subject: [edk2-devel] [PATCH v2] UnitTestFrameworkPkg/UnitTestLib: Check Suite pointer before use. Date: Thu, 5 Mar 2020 14:17:47 +0800 Message-Id: Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,newexplorerj@gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1583389159; bh=jQplEtTbN1d/KfA3qX7kOerT0GVTtns1cBr7mqn9LXA=; h=Cc:Date:From:Reply-To:Subject:To; b=QkOePrjoy6WJ+nAX5FHDdlTFsMY2/TuAifeIyCM4HPptG9i1ZZf4f6vdIqNkaJa424Z +sm6YkF5l73AuvWtEYkCZqJNBkfxkSPqDKgmdl3IfidUB7F0o/MUFHN4mom/UmfNMsnIl J06UIB+Kk+5LfS2uz+Z48UcmKQS8VUv5oy0= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Bret Barkelew Reviewed-by: Michael D Kinney Reviewed-by: Shenglei Zhang --- 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/UnitTest= FrameworkPkg/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; =20 - TestEntry =3D NULL; - ParentFramework =3D (UNIT_TEST_FRAMEWORK *)Suite->ParentFramework; - if (Suite =3D=3D NULL) { return EFI_INVALID_PARAMETER; } =20 + 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/UnitT= estFrameworkPkg/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 ( =20 Status =3D EFI_SUCCESS; Suite =3D (UNIT_TEST_SUITE *)SuiteHandle; - ParentFramework =3D (UNIT_TEST_FRAMEWORK *)Suite->ParentFramework; =20 // // First, let's check to make sure that our parameters look good. @@ -445,6 +444,7 @@ AddTestCase ( return EFI_INVALID_PARAMETER; } =20 + ParentFramework =3D (UNIT_TEST_FRAMEWORK *)Suite->ParentFramework; // // Create the new entry. NewTestEntry =3D AllocateZeroPool (sizeof( UNIT_TEST_LIST_ENTRY )); --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#55476): https://edk2.groups.io/g/devel/message/55476 Mute This Topic: https://groups.io/mt/71744323/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-