From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=eric.dong@intel.com; receiver=edk2-devel@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 81A83201B0431 for ; Wed, 13 Feb 2019 23:18:34 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Feb 2019 23:18:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,367,1544515200"; d="scan'208";a="299646047" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga005.jf.intel.com with ESMTP; 13 Feb 2019 23:18:33 -0800 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 13 Feb 2019 23:18:33 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 13 Feb 2019 23:18:33 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.207]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.102]) with mapi id 14.03.0415.000; Thu, 14 Feb 2019 15:18:31 +0800 From: "Dong, Eric" To: "Chu, Maggie" , "edk2-devel@lists.01.org" CC: "Yao, Jiewen" , "Zhang, Chao B" Thread-Topic: [edk2] [PATCH] SecurityPkg/OpalPassword: Add NULL pointer check before using it Thread-Index: AQHUuhsbLd2Ru7dQaUa/JktWnJUWhqXe7/Nw Date: Thu, 14 Feb 2019 07:18:30 +0000 Message-ID: References: <20190201104405.14104-1-maggie.chu@intel.com> In-Reply-To: <20190201104405.14104-1-maggie.chu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] SecurityPkg/OpalPassword: Add NULL pointer check before using it X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Feb 2019 07:18:34 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Maggie, Thanks for your contribution. Reviewed-by: Eric Dong Pushed: d72d8561fbe03a64e01c2ad57a93777de4b9ae2f Thanks, Eric > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Maggie Chu > Sent: Friday, February 1, 2019 6:44 PM > To: edk2-devel@lists.01.org > Cc: Yao, Jiewen ; Dong, Eric ; > Zhang, Chao B > Subject: [edk2] [PATCH] SecurityPkg/OpalPassword: Add NULL pointer check > before using it >=20 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D1503 > A pointer variable should be checked if it is NULL or Valid before using = it. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Maggie Chu > Cc: Chao Zhang > Cc: Jiewen Yao > Cc: Eric Dong > --- > SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c | 6 ++++++ > 1 file changed, 6 insertions(+) >=20 > diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c > b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c > index 734c5f06ff..f79f9f7282 100644 > --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c > +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c > @@ -436,6 +436,9 @@ BuildOpalDeviceInfoAta ( >=20 > DevInfoAta =3D AllocateZeroPool (DevInfoLengthAta); > ASSERT (DevInfoAta !=3D NULL); > + if (DevInfoAta =3D=3D NULL) { > + return; > + } >=20 > TempDevInfoAta =3D DevInfoAta; > TmpDev =3D mOpalDriver.DeviceList; > @@ -527,6 +530,9 @@ BuildOpalDeviceInfoNvme ( >=20 > DevInfoNvme =3D AllocateZeroPool (DevInfoLengthNvme); > ASSERT (DevInfoNvme !=3D NULL); > + if (DevInfoNvme =3D=3D NULL) { > + return; > + } >=20 > TempDevInfoNvme =3D DevInfoNvme; > TmpDev =3D mOpalDriver.DeviceList; > -- > 2.16.2.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel