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.24, mailfrom: ray.ni@intel.com) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by groups.io with SMTP; Mon, 26 Aug 2019 17:47:38 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Aug 2019 17:47:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,435,1559545200"; d="scan'208";a="180050165" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga008.fm.intel.com with ESMTP; 26 Aug 2019 17:47:37 -0700 Received: from shsmsx154.ccr.corp.intel.com (10.239.6.54) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 26 Aug 2019 17:47:36 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.112]) by SHSMSX154.ccr.corp.intel.com ([169.254.7.249]) with mapi id 14.03.0439.000; Tue, 27 Aug 2019 08:47:34 +0800 From: "Ni, Ray" To: "Kubacki, Michael A" , "'devel@edk2.groups.io'" CC: "Chaganty, Rangasai V" Subject: Re: [edk2-platforms][PATCH V1 1/1] IntelSiliconPkg/IntelVTdDxe: Fix NULL pointer dereference Thread-Topic: [edk2-platforms][PATCH V1 1/1] IntelSiliconPkg/IntelVTdDxe: Fix NULL pointer dereference Thread-Index: AQHVWic8qBHwAwe5+ECDs1ddlZrcpacOHd2AgAAPgkA= Date: Tue, 27 Aug 2019 00:47:33 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C29CF1D@SHSMSX104.ccr.corp.intel.com> References: <20190824025411.1192-1-michael.a.kubacki@intel.com> <734D49CCEBEEF84792F5B80ED585239D5C29CD54@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5C29CD54@SHSMSX104.ccr.corp.intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTIwMWJhNmYtZTIzOS00MmRiLTllYWYtNDQ4ODM3YjZjN2MzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiN2pYRDJJU3p5Yk1mUjdBQ284eDRjRnpkT3ErS0RQc3lNS1NFQkhxdFBySEUzRkpQSFNMQWdJN3ExUHlNR1dCbiJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: ray.ni@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable sorry for the false alarm. The issue I met before is not like this one. There is no unreachable code i= ssue. Reviewed-by: Ray Ni Thanks, Ray > -----Original Message----- > From: Ni, Ray > Sent: Monday, August 26, 2019 4:52 PM > To: Kubacki, Michael A ; devel@edk2.groups.i= o > Cc: Chaganty, Rangasai V > Subject: RE: [edk2-platforms][PATCH V1 1/1] IntelSiliconPkg/IntelVTdDxe: = Fix NULL pointer dereference >=20 > Michael, >=20 >=20 > > -----Original Message----- > > From: Kubacki, Michael A > > Sent: Friday, August 23, 2019 7:54 PM > > To: devel@edk2.groups.io > > Cc: Ni, Ray ; Chaganty, Rangasai V > > Subject: [edk2-platforms][PATCH V1 1/1] IntelSiliconPkg/IntelVTdDxe: Fi= x NULL pointer dereference > > > > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2116 > > > > Cc: Ray Ni > > Cc: Rangasai V Chaganty > > Signed-off-by: Michael Kubacki > > --- > > Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection.c = | 19 +++++++++++-------- > > 1 file changed, 11 insertions(+), 8 deletions(-) > > > > diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaP= rotection.c > > b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection.c > > index 956ebb2d3d..9b6135ef94 100644 > > --- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtecti= on.c > > +++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtecti= on.c > > @@ -158,10 +158,13 @@ ProcessRequestedAccessAttribute ( > > } > > > > /** > > - return the UEFI memory information. > > + Return UEFI memory map information. > > + > > + @param[out] Below4GMemoryLimit The below 4GiB memory limit address = or 0 if insufficient resources exist to > > + determine the address. > > + @param[out] Above4GMemoryLimit The above 4GiB memory limit address = or 0 if insufficient resources exist to > > + determine the address. > > > > - @param[out] Below4GMemoryLimit The below 4GiB memory limit > > - @param[out] Above4GMemoryLimit The above 4GiB memory limit > > **/ > > VOID > > ReturnUefiMemoryMap ( > > @@ -206,7 +209,11 @@ ReturnUefiMemoryMap ( > > // we process bogus entries and create bogus E820 entries. > > // > > EfiMemoryMap =3D (EFI_MEMORY_DESCRIPTOR *) AllocatePool (EfiMemory= MapSize); > > - ASSERT (EfiMemoryMap !=3D NULL); > > + if (EfiMemoryMap =3D=3D NULL) { > > + ASSERT (EfiMemoryMap !=3D NULL); >=20 > Above line may trigger a unreachable code error from some static code sca= nner. > How about move assertion to the line before if? >=20 > > + return; > > + } > > + > > Status =3D gBS->GetMemoryMap ( > > &EfiMemoryMapSize, > > EfiMemoryMap, > > @@ -218,7 +225,6 @@ ReturnUefiMemoryMap ( > > FreePool (EfiMemoryMap); > > } > > } while (Status =3D=3D EFI_BUFFER_TOO_SMALL); > > - > > ASSERT_EFI_ERROR (Status); > > > > // > > @@ -242,9 +248,6 @@ ReturnUefiMemoryMap ( > > NextEfiEntry =3D NEXT_MEMORY_DESCRIPTOR (EfiEntry, EfiDescriptorS= ize); > > } > > > > - // > > - // > > - // > > DEBUG ((DEBUG_INFO, "MemoryMap:\n")); > > EfiEntry =3D EfiMemoryMap; > > EfiMemoryMapEnd =3D (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) EfiMemoryMa= p + EfiMemoryMapSize); > > -- > > 2.16.2.windows.1