From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Permerror (SPF Permanent Error: Void lookup limit of 2 exceeded) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=jiewen.yao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 84473222DDBE7 for ; Sun, 14 Jan 2018 19:09:16 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Jan 2018 19:14:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,361,1511856000"; d="scan'208";a="10658363" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga002.fm.intel.com with ESMTP; 14 Jan 2018 19:14:34 -0800 Received: from fmsmsx101.amr.corp.intel.com (10.18.124.199) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 14 Jan 2018 19:14:33 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx101.amr.corp.intel.com (10.18.124.199) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 14 Jan 2018 19:14:33 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.189]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.93]) with mapi id 14.03.0319.002; Mon, 15 Jan 2018 11:14:31 +0800 From: "Yao, Jiewen" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: "Zeng, Star" Thread-Topic: [edk2] [PATCH] IntelSiliconPkg IntelVTdDxe: Fix potential NULL pointer dereference Thread-Index: AQHTjamVPqDA9shFb022gVxDCHrBzqN0Qoww Date: Mon, 15 Jan 2018 03:14:31 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503AA7D156@shsmsx102.ccr.corp.intel.com> References: <1515983723-14100-1-git-send-email-star.zeng@intel.com> In-Reply-To: <1515983723-14100-1-git-send-email-star.zeng@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOGNmOGU1ZDItZDA0ZS00OTFkLTg1ZmYtMTAzNjA3MmYxY2UyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJxT0RsK2RrNXNEQ2Y4dFVuSWNkS0UzVHJPblRoeWVmVGtCZytPT3RaditLNk5IN1MyRmJTWFwvSEVCUWpUYmlIOSJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] IntelSiliconPkg IntelVTdDxe: Fix potential NULL pointer dereference X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jan 2018 03:09:19 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jiewen.yao@intel.com > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of St= ar > Zeng > Sent: Monday, January 15, 2018 10:35 AM > To: edk2-devel@lists.01.org > Cc: Yao, Jiewen ; Zeng, Star > Subject: [edk2] [PATCH] IntelSiliconPkg IntelVTdDxe: Fix potential NULL p= ointer > dereference >=20 > The implementation of MdeModulePkg\Universal\Acpi\AcpiTableDxe reserves > first entry of RSDT/XSDT to FADT, the first entry value is 0 when FADT > is installed. So the RSDT/XSDT parsing code should check the entry value > first before checking the table signature. >=20 > Cc: Jiewen Yao > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Star Zeng > --- > IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >=20 > diff --git a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable.c > b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable.c > index b981bcdb3aa0..342830a01fb0 100644 > --- a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable.c > +++ b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable.c > @@ -1,6 +1,6 @@ > /** @file >=20 > - Copyright (c) 2017, Intel Corporation. All rights reserved.
> + Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the = BSD > License > which accompanies this distribution. The full text of the license may= be > found at > @@ -889,7 +889,7 @@ ScanTableInRSDT ( > EntryPtr =3D &Rsdt->Entry; > for (Index =3D 0; Index < EntryCount; Index ++, EntryPtr ++) { > Table =3D (EFI_ACPI_DESCRIPTION_HEADER*)((UINTN)(*EntryPtr)); > - if (Table->Signature =3D=3D Signature) { > + if ((Table !=3D NULL) && (Table->Signature =3D=3D Signature)) { > return Table; > } > } > @@ -923,7 +923,7 @@ ScanTableInXSDT ( > for (Index =3D 0; Index < EntryCount; Index ++) { > CopyMem (&EntryPtr, (VOID *)(BasePtr + Index * sizeof(UINT64)), > sizeof(UINT64)); > Table =3D (EFI_ACPI_DESCRIPTION_HEADER*)((UINTN)(EntryPtr)); > - if (Table->Signature =3D=3D Signature) { > + if ((Table !=3D NULL) && (Table->Signature =3D=3D Signature)) { > return Table; > } > } > -- > 2.7.0.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel