From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=iPsr55IU; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: michael.a.kubacki@intel.com) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by groups.io with SMTP; Wed, 18 Sep 2019 21:14:15 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Sep 2019 21:14:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,522,1559545200"; d="scan'208";a="187968392" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga007.fm.intel.com with ESMTP; 18 Sep 2019 21:14:15 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 18 Sep 2019 21:14:14 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 18 Sep 2019 21:14:14 -0700 Received: from FMSEDG002.ED.cps.intel.com (10.1.192.134) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 18 Sep 2019 21:14:14 -0700 Received: from NAM05-BY2-obe.outbound.protection.outlook.com (104.47.50.54) by edgegateway.intel.com (192.55.55.69) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 18 Sep 2019 21:14:14 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g4/jNCWYEQZ+FifJmS0mcboyps9b3MvAhdrJDXwR6Xgk2sZl910S5frpC2c5742YaVAh/whaY5ePfFLE1a9Uo8AhosS5QpmF1XJUx5fwKjpuViDXlw6CFYSNG24DdHK/psyYCnVitz4/6Vg1E2kTGZb/2ANJ6YGYftB+YlWPa4HdPLD6qGXQ+hP18HBqxnKyMx0SGPKtBE1UsieyMMcTXTxPM1sef4Q6Zu4OVNsDQSJQJCJYh/Fr4ja+opE5FgBRzjsW1OH0ZUQuoCkja1VnsPK3lLSbVgB/YeWarV7Kczt+WSU9FNh8VI0/deR9qgIDBWe9jlfcZ4YBTbowwklfEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ATSlsPXVbwbsKJE3NrApFcvxgzpW45OX9yzz6tZo0H0=; b=PHTkmbjTEOM782ySrsRUmKe44NmxYgMSCqcv7iLFbfZaLbJTxkNDDQv+tNA0FbkgbJHV6Tn8fLa7GuNXKsqpmj5sKZCHkl+Ks+Sc/2GmvcCCWlA54Sihqf0R/JH3jRPcBblMOs4jqbgR3sVOz6+6qH8Pr6FZW8JC4dWoS2SHTB1VfhEE22zsIKKhosgitYGleOfAswdBVbWkXdcWIxrlXRJBLtRf5YsYCMppH+dU1S3u3JzgDya+vuYwVIa8UQTwH/2wd17HcVkzE6Us1K7Xk11cH8Ebbwl84l2wcWMQnD0BwY7m7FRdJ0tgjY6960F2SgjD9Z/e0MwgmIi/yLl35g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ATSlsPXVbwbsKJE3NrApFcvxgzpW45OX9yzz6tZo0H0=; b=iPsr55IUWu25j/V61uwc6GDDxkwNFpq3W9bhNY5Imh+rESPbcz4TBH2P845s0nzOJk/yMY4OzcHRR3Jt42fOr1+8z0dQxaN+2AOljLWC0MMZ3DFFQq944bVmKKWt9nLIbFg4bzhrlglXy9FgddUrTB4KjiLCd23r2Od7rgXir64= Received: from DM6PR11MB3834.namprd11.prod.outlook.com (20.179.17.87) by DM6PR11MB4441.namprd11.prod.outlook.com (52.132.250.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2263.21; Thu, 19 Sep 2019 04:14:12 +0000 Received: from DM6PR11MB3834.namprd11.prod.outlook.com ([fe80::c093:6e7b:c014:6658]) by DM6PR11MB3834.namprd11.prod.outlook.com ([fe80::c093:6e7b:c014:6658%6]) with mapi id 15.20.2284.009; Thu, 19 Sep 2019 04:14:12 +0000 From: "Kubacki, Michael A" To: "Zhang, Shenglei" , "devel@edk2.groups.io" CC: "Chiu, Chasel" , "Desimone, Nathaniel L" , "Gao, Liming" Subject: Re: [PATCH v4] MinPlatformPkg/TestPointCheckLib: Add check for pointers Thread-Topic: [PATCH v4] MinPlatformPkg/TestPointCheckLib: Add check for pointers Thread-Index: AQHVbesfoZsyBY9Yt0CKb8L0s1dCM6cyZIPA Date: Thu, 19 Sep 2019 04:14:12 +0000 Message-ID: References: <20190918063412.48816-1-shenglei.zhang@intel.com> In-Reply-To: <20190918063412.48816-1-shenglei.zhang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMTBlYTlhOGMtZmI0MS00ODQ2LWJkZjYtM2M0NDM2MWMyNGQ0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiXC9Vcm9UWWhKR3ZkaHNlR3B0RGdpQ3BsczlnXC90ZVJNQ0hZWDdQc0x6NnhvM3ZyNXBhNGlPSHA2VVJZaCtkYUJSIn0= dlp-reaction: no-action dlp-version: 11.2.0.6 authentication-results: spf=none (sender IP is ) smtp.mailfrom=michael.a.kubacki@intel.com; x-originating-ip: [134.134.136.217] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 221de7ce-7c7a-4bfd-45b1-08d73cb7d3c9 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600167)(711020)(4605104)(1401327)(2017052603328)(7193020);SRVR:DM6PR11MB4441; x-ms-traffictypediagnostic: DM6PR11MB4441: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4125; x-forefront-prvs: 016572D96D x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(396003)(136003)(346002)(39860400002)(376002)(199004)(13464003)(189003)(478600001)(66066001)(2501003)(110136005)(107886003)(6116002)(8676002)(316002)(14454004)(6246003)(305945005)(486006)(3846002)(7736002)(5660300002)(81166006)(81156014)(6436002)(14444005)(8936002)(256004)(76116006)(25786009)(66946007)(99286004)(229853002)(66476007)(446003)(2906002)(66556008)(64756008)(54906003)(9686003)(102836004)(26005)(71190400001)(186003)(55016002)(74316002)(33656002)(11346002)(86362001)(6506007)(53546011)(4326008)(71200400001)(52536014)(476003)(76176011)(66446008)(7696005);DIR:OUT;SFP:1102;SCL:1;SRVR:DM6PR11MB4441;H:DM6PR11MB3834.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: FfNFnYgJ8luRRV/62XJYl1iuQDvSd+EUl7SLpMc8CkWD25Z/gbyPoNoBIIEjaivV074ODQkb4Lq2yKua1KJvy6Ad3I7jGlexTs+8otQFNFUrdQ9rMU+K84VoAiowE//8xhzNdAiEqdDIPoCxmrygbNlhW1tSE/Jv91vCmcPQHHi5gNBRyxcdtHvrQq9nBehW2tjaSZ2dIl+zilM34UC1l2pqwEcKVixZT99+N1EMMci9XOBijZ8dysqlvZAYxfqJwO6Bl1s5KwG8PuCJM5eEPTYHtz8MkNzu1LHnrWqfrhPDAPn8cXp4eQXxcWjfjWCa8cJvoPP8fg6ip/zp2e+EprGdAARH6DoIT5q1EseVZTOdbxn90sCncPWUspeUv102xVu4W/DRf0hAh2PfWWJkdgRMXb3SxxQOnghV4Kn6x6Q= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 221de7ce-7c7a-4bfd-45b1-08d73cb7d3c9 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Sep 2019 04:14:12.5449 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: HCHRlbjU0mvCepvvrfIus2YU0jvkHOoOESdJeocC9hY8L8EBbYgTzWgGBdiy/b5ojzUyD26YhpNNPD7Y6Xad6bTyWJ0HdXyYGOiMoyIaB7o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4441 Return-Path: michael.a.kubacki@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 1. PatchCheck flags commit message length 2. Please put [edk2-platforms] in the subject line for patches to the edk2-= platforms repository 3. Please send a new patch with these changes and the changes for Chasel's = feedback included > -----Original Message----- > From: Zhang, Shenglei > Sent: Tuesday, September 17, 2019 11:34 PM > To: devel@edk2.groups.io > Cc: Kubacki, Michael A ; Chiu, Chasel > ; Desimone, Nathaniel L > ; Gao, Liming > Subject: [PATCH v4] MinPlatformPkg/TestPointCheckLib: Add check for > pointers >=20 > In DxeCheckBootVariable.c, add check for BootOrder and Variable that > return EFI_NOT_FOUND when they are NULL. > In DxeCheckGcd.c, add check for GcdIoMap to ensure it not NULL when > allocating memory to what it points to. >=20 > Cc: Michael Kubacki > Cc: Chasel Chiu > Cc: Nate DeSimone > Cc: Liming Gao > Signed-off-by: Shenglei Zhang > --- >=20 > v2: Update copyright >=20 > v3: Fix the coding style. >=20 > v4: Update the logic in DxeCheckBootVariable.c. > We directly return when BootOrder/Variable =3D=3D NULL, in previous > versions. >=20 > .../Test/Library/TestPointCheckLib/DxeCheckBootVariable.c | 6 +++--- > .../Test/Library/TestPointCheckLib/DxeCheckGcd.c | 8 +++++--- > 2 files changed, 8 insertions(+), 6 deletions(-) >=20 > diff --git > a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck > BootVariable.c > b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck > BootVariable.c > index 85bd5b3d..06a40505 100644 > --- > a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck > BootVariable.c > +++ > b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCh > +++ eckBootVariable.c > @@ -1,6 +1,6 @@ > /** @file >=20 > -Copyright (c) 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 2017-2019, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ > @@ -130,7 +130,7 @@ TestPointCheckLoadOptionVariable ( > for (ListIndex =3D 0; ListIndex < > sizeof(mLoadOptionVariableList)/sizeof(mLoadOptionVariableList[0]); > ListIndex++) { > UnicodeSPrint (BootOrderName, sizeof(BootOrderName), L"%sOrder", > mLoadOptionVariableList[ListIndex]); > Status =3D GetVariable2 (BootOrderName, &gEfiGlobalVariableGuid, (VO= ID > **)&BootOrder, &OrderSize); > - if (EFI_ERROR(Status)) { > + if (EFI_ERROR(Status)||(BootOrder =3D=3D NULL)) { > continue; > } > for (Index =3D 0; Index < OrderSize/sizeof(CHAR16); Index++) { @@ -2= 22,7 > +222,7 @@ TestPointCheckKeyOptionVariable ( > for (Index =3D 0; ; Index++) { > UnicodeSPrint (KeyOptionName, sizeof(KeyOptionName), L"%s%04x", > mKeyOptionVariableList[ListIndex], Index); > Status =3D GetVariable2 (KeyOptionName, &gEfiGlobalVariableGuid, > &Variable, &Size); > - if (!EFI_ERROR(Status)) { > + if (!EFI_ERROR(Status)&&(Variable !=3D NULL)) { > DumpKeyOption (KeyOptionName, Variable, Size); > } else { > break; > diff --git > a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck > Gcd.c > b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck > Gcd.c > index 82709d44..28ca8382 100644 > --- > a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck > Gcd.c > +++ > b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCh > +++ eckGcd.c > @@ -1,6 +1,6 @@ > /** @file >=20 > -Copyright (c) 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 2017-2019, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ > @@ -241,11 +241,13 @@ TestPointDumpGcd ( > } > } > if (GcdMemoryMap !=3D NULL) { > - *GcdIoMap =3D AllocateCopyPool (NumberOfDescriptors * > sizeof(EFI_GCD_IO_SPACE_DESCRIPTOR), IoMap); > + if (GcdIoMap !=3D NULL) { > + *GcdIoMap =3D AllocateCopyPool (NumberOfDescriptors * > sizeof(EFI_GCD_IO_SPACE_DESCRIPTOR), IoMap); > + } > *GcdIoMapNumberOfDescriptors =3D NumberOfDescriptors; > } > } > - > + > if (DumpPrint) { > DEBUG ((DEBUG_INFO, "=3D=3D=3D=3D TestPointDumpGcd - Exit\n")); > } > -- > 2.18.0.windows.1