From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: zhichao.gao@intel.com) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by groups.io with SMTP; Fri, 16 Aug 2019 00:34:36 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Aug 2019 00:34:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,391,1559545200"; d="scan'208";a="261044232" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga001.jf.intel.com with ESMTP; 16 Aug 2019 00:34:35 -0700 Received: from fmsmsx123.amr.corp.intel.com (10.18.125.38) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 16 Aug 2019 00:34:35 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx123.amr.corp.intel.com (10.18.125.38) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 16 Aug 2019 00:34:35 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.80]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.139]) with mapi id 14.03.0439.000; Fri, 16 Aug 2019 15:34:33 +0800 From: "Gao, Zhichao" To: Krzysztof Koch , "devel@edk2.groups.io" CC: "Carsey, Jaben" , "Ni, Ray" , "Sami.Mujawar@arm.com" , "Matteo.Carlini@arm.com" , "nd@arm.com" Subject: Re: [PATCH v1 03/11] ShellPkg: acpiview: FADT: Validate global pointer before use Thread-Topic: [PATCH v1 03/11] ShellPkg: acpiview: FADT: Validate global pointer before use Thread-Index: AQHVU2sLq1shhzTWPU6bIns9p4W1aKb9YYCQ Date: Fri, 16 Aug 2019 07:34:32 +0000 Message-ID: <3CE959C139B4C44DBEA1810E3AA6F9000B823290@SHSMSX101.ccr.corp.intel.com> References: <20190815131121.52644-1-krzysztof.koch@arm.com> <20190815131121.52644-4-krzysztof.koch@arm.com> In-Reply-To: <20190815131121.52644-4-krzysztof.koch@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: zhichao.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable For FadtMinorRevision and X_DsdtAddress, I don't think they are required se= ction. Maybe we should consider check the length before check them. As I kn= ow, the OVMF's FACP table doesn't have the section after flag. Thanks, Zhichao > -----Original Message----- > From: Krzysztof Koch [mailto:krzysztof.koch@arm.com] > Sent: Thursday, August 15, 2019 9:11 PM > To: devel@edk2.groups.io > Cc: Carsey, Jaben ; Ni, Ray ; > Gao, Zhichao ; Sami.Mujawar@arm.com; > Matteo.Carlini@arm.com; nd@arm.com > Subject: [PATCH v1 03/11] ShellPkg: acpiview: FADT: Validate global point= er > before use >=20 > Check if global pointers have been successfully updated before they are > used for further table parsing. >=20 > Signed-off-by: Krzysztof Koch > --- >=20 > Notes: > v1: > - Test against NULL pointers [Krzysztof] >=20 > ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c > | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) >=20 > diff --git > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser. > c > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser. > c > index > e40c9ef8ee4b3285faf8c6edf3cb6236ee367397..e218e45926abced1096e75441 > e22108db7a3a811 100644 > --- > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser. > c > +++ > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtPars > +++ er.c > @@ -203,6 +203,20 @@ ParseAcpiFadt ( > PARSER_PARAMS (FadtParser) > ); >=20 > + // Check if the values used to control the parsing logic have been > + // successfully read. > + if ((DsdtAddress =3D=3D NULL) || > + (FadtMinorRevision =3D=3D NULL) || > + (X_DsdtAddress =3D=3D NULL)) { > + IncrementErrorCount (); > + Print ( > + L"ERROR: Insufficient table length. AcpiTableLength =3D %d. " \ > + L"FADT parsing aborted.\n", > + AcpiTableLength > + ); > + return; > + } > + > if (Trace) { > Print (L"\nSummary:\n"); > PrintFieldName (2, L"FADT Version"); > -- > 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' >=20