From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: hao.a.wu@intel.com) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by groups.io with SMTP; Sun, 11 Aug 2019 18:48:23 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Aug 2019 18:48:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,375,1559545200"; d="scan'208";a="351043263" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga005.jf.intel.com with ESMTP; 11 Aug 2019 18:48:22 -0700 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 11 Aug 2019 18:48:21 -0700 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 11 Aug 2019 18:48:21 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.112]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.65]) with mapi id 14.03.0439.000; Mon, 12 Aug 2019 09:48:20 +0800 From: "Wu, Hao A" To: "devel@edk2.groups.io" , "Zeng, Star" Subject: Re: [edk2-devel] [PATCH] SourceLevelDebugPkg DebugCommLibUsb3: Address NULL ptr dereference case Thread-Topic: [edk2-devel] [PATCH] SourceLevelDebugPkg DebugCommLibUsb3: Address NULL ptr dereference case Thread-Index: AQHVTlVTFZEDRM/XKECWPPvV6ER0+6b2wx4A Date: Mon, 12 Aug 2019 01:48:20 +0000 Message-ID: References: <20190809015345.63500-1-star.zeng@intel.com> In-Reply-To: <20190809015345.63500-1-star.zeng@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: hao.a.wu@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > Zeng, Star > Sent: Friday, August 09, 2019 9:54 AM > To: devel@edk2.groups.io > Cc: Zeng, Star; Wu, Hao A > Subject: [edk2-devel] [PATCH] SourceLevelDebugPkg DebugCommLibUsb3: > Address NULL ptr dereference case >=20 > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2051 >=20 > Original code GetConfigTable for AddrPtr first, if failed, > InstalConfigTable with allocated AddrPtr. So the AddrPtr > should not be NULL and the NULL pointer dereference case > should be false positive. This patch is just to address > the case raised from static analysis. >=20 > Cc: Hao A Wu > Signed-off-by: Star Zeng > --- > .../DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.c | 2 > +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git > a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCom > municationLibUsb3Dxe.c > b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCom > municationLibUsb3Dxe.c > index eee30c852ffd..d4245465ce74 100644 > --- > a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCom > municationLibUsb3Dxe.c > +++ > b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCom > municationLibUsb3Dxe.c > @@ -447,7 +447,7 @@ DebugCommunicationUsb3DxeConstructor ( > EFI_EVENT Event; >=20 > Status =3D EfiGetSystemConfigurationTable (&gUsb3DbgGuid, (VOID **) > &AddrPtr); > - if (EFI_ERROR (Status)) { > + if (EFI_ERROR (Status) || (AddrPtr =3D=3D NULL)) { Reviewed-by: Hao A Wu And pushed via commit 4053587347. Best Regards, Hao Wu > // > // Instead of using local variables, install system configuration t= able for > // the local instance and the buffer to save instance address point= er. > -- > 2.21.0.windows.1 >=20 >=20 >=20