From nobody Tue Apr 23 12:06:51 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+43645+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1562914421376111.11260954669831; Thu, 11 Jul 2019 23:53:41 -0700 (PDT) Return-Path: X-Received: from EUR04-HE1-obe.outbound.protection.outlook.com (EUR04-HE1-obe.outbound.protection.outlook.com [40.107.7.75]) by groups.io with SMTP; Thu, 11 Jul 2019 23:53:39 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VWPGyQ9xW8B+fvTF3vHN2uLKGhAglxYVCuiBEjPyRnN3o/Em0FVyoqTmmhszEVRLjR94YbNM4fX8Q9jMKrhXTlekJwIgNDfLz1G1NeO83rHP7OQlb5e3AnKZigKhl7BhI/ryg7MLl075mOcXe5iDn4ogXfDLUrX10Fi1L/YewuX1BB1WbKrO3N02iOVaKB/efagiF51TYG8+D2gyfJn86Ia5G19t7xBSeVUEslCtSuke9RbzCVfssnPhcdCCHyVblSm/QcZNI4Gx77jDXwUe1RnIuXYCwm81pz9GKMbImmcVSnzUp/eWodLxV5TExML2o3lkEOLPSR6bUPHqyvXymQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+0H1GzoAIa47QCjHdNGtwp7Uuv8V/jaL8qnZyT0KtU4=; b=AM2jT/dD/QQ3k4r9j0dDBgTIeqzvQ/yDfdFir4rhTn08qK7EkSlJoRmlTW2mOTlRoFOIx1V94IWeuklBoSNjHa0x1UgsZAEtB2DIH6WP+rcfBTpzMYHfwlLtWr2DrBK+jbZUW2TGI0Yt32u4haFpOeb7j2QdxJww8FyStthGhCBTE63v+WvxdJQPEgbiXQEZXwCGLd/v6+wfqqeROdoFFxC3xOlnXpNWtUkR2qQIB5voY4FoA4UvzQqcniLF3aKt5Z7y1QiZcHf9U2f5MNfTPjw26u0/k1ocz8zHGoM51S7o5Vgdrs36jgGcGt56lfr5MRSb3ekf9cAAvZwtC0rppQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=temperror (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com;dmarc=temperror action=none header.from=arm.com;dkim=none (message not signed);arc=none X-Received: from VI1PR08CA0148.eurprd08.prod.outlook.com (2603:10a6:800:d5::26) by HE1PR0802MB2601.eurprd08.prod.outlook.com (2603:10a6:3:d8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2073.14; Fri, 12 Jul 2019 06:53:35 +0000 X-Received: from DB5EUR03FT040.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::203) by VI1PR08CA0148.outlook.office365.com (2603:10a6:800:d5::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2073.11 via Frontend Transport; Fri, 12 Jul 2019 06:53:35 +0000 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+43645+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) X-Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT040.mail.protection.outlook.com (10.152.20.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2052.18 via Frontend Transport; Fri, 12 Jul 2019 06:53:34 +0000 X-Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1415.2; Fri, 12 Jul 2019 06:53:18 +0000 X-Received: from E119924.Arm.com (10.37.8.167) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Fri, 12 Jul 2019 06:53:18 +0000 From: "Krzysztof Koch" To: CC: , , , , , Subject: [edk2-devel] [PATCH v1 04/11] ShellPkg: acpiview: XSDT: Remove redundant ParseAcpi() call Date: Fri, 12 Jul 2019 07:52:36 +0100 Message-ID: <20190712065243.3812-5-krzysztof.koch@arm.com> In-Reply-To: <20190712065243.3812-1-krzysztof.koch@arm.com> References: <20190712065243.3812-1-krzysztof.koch@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d6eb6ec3-b290-4a5e-7577-08d70695a85d X-MS-TrafficTypeDiagnostic: HE1PR0802MB2601: X-MS-Exchange-PUrlCount: 1 X-Microsoft-Antispam-PRVS: NoDisclaimer: True X-MS-Oob-TLC-OOBClassifiers: OLM:4125; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: 38FxzdzHAU5001ZN3P3pczQcphpAbL9QrYG3jjTr1TYnl7UYLB1/Xn9xXlgmzdd0hKHobGNc4eE91JdTHLuJcEYveAc5mjaqB0dykCDLwozHNRAh3TwQi2L4WZFHk5mnKkSScldUc3NRSgrm7cFvo8/GxkzwcPu8tjE6sYMOISNKTTZscDnz8GTTkBOMI1LaczdSoI+HrAK2glXd4AL6wNtssg1LALy/8wB03CMUQvzcuiQMm3m1kTu7tcvqITkhElz8gSiXPSGACBs1TbpeZfB6F4WHaWXZZBiGei+koOCl+rnUTLnwIHiRKAVakGios080rywxd6gtZKUG0sbFyY1+f9zPxRORKVo2Em1ts01klS4khzUS50zOCuWPThTfOO6SampkIrnFum/U5i7sfZYA8xWC7nx9XRm8LG2wkjY= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jul 2019 06:53:34.0675 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d6eb6ec3-b290-4a5e-7577-08d70695a85d X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[40.67.248.234];Helo=[nebula.arm.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2601 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,krzysztof.koch@arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1562914419; bh=7NlSaGQqspdezdFpP0hSxKGMP4DLVklDfA5MCeuh3uE=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=Zv5P5R8Q00TuQZPRHY92yLKeac4pAr0xSZwrEGP6/Wux/nwcCoRxaf+oQJBWBKU9FUU uj+A6HlZAkb7RfRO3PQozhxI2tWtZZz2DBmwVIJEd927Y0+UWse74X868m6uVQk3wm3CD CXxfxqt+OnWAmOGOIPJHdOO01102cE3RLs4= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 1. Remove a call to ParseAcpi responsible for getting the XSDT table length. This call is not needed because the ACPI table buffer length is provided as an input argument to the ParseAcpiXsdt() function. 2. Use ParseAcpiXsdt function argument instead of a global variable to check against table buffer overruns. 3. Allow suppressing errors about invalid ACPI table poiners inside the XSDT table. Signed-off-by: Krzysztof Koch Reviewed-by: Alexei Fedorov --- Changes can be seen at: https://github.com/KrzysztofKoch1/edk2/commit/27b4a= e23c4f230225d6bcb27598b42edcf329512 Notes: v1: - Remove a redundant call to ParseAcpi() [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c | 2= 2 +++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/Xsdt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtPa= rser.c index 4196168bff47d70c67f79f3fc1f4cdee302d460e..b7d8f4215a71ef429fb88d6f2d9= 98d8f38250716 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c @@ -1,7 +1,7 @@ /** @file XSDT table parser =20 - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2019, ARM Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -13,6 +13,7 @@ #include #include "AcpiParser.h" #include "AcpiTableParser.h" +#include "AcpiView.h" =20 // Local variables STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; @@ -60,22 +61,12 @@ ParseAcpiXsdt ( UINTN EntryIndex; CHAR16 Buffer[32]; =20 - // Parse the ACPI header to get the length - ParseAcpi ( - FALSE, - 0, - "XSDT", - Ptr, - ACPI_DESCRIPTION_HEADER_LENGTH, - PARSER_PARAMS (XsdtParser) - ); - Offset =3D ParseAcpi ( Trace, 0, "XSDT", Ptr, - *AcpiHdrInfo.Length, + AcpiTableLength, PARSER_PARAMS (XsdtParser) ); =20 @@ -84,7 +75,7 @@ ParseAcpiXsdt ( if (Trace) { EntryIndex =3D 0; TablePointer =3D (UINT64*)(Ptr + TableOffset); - while (Offset < (*AcpiHdrInfo.Length)) { + while (Offset < AcpiTableLength) { CONST UINT32* Signature; CONST UINT32* Length; CONST UINT8* Revision; @@ -124,7 +115,8 @@ ParseAcpiXsdt ( Print (L"0x%lx\n", *TablePointer); =20 // Validate the table pointers are not NULL - if ((UINT64*)(UINTN)(*TablePointer) =3D=3D NULL) { + if (GetConsistencyChecking () && + ((UINT64*)(UINTN)(*TablePointer) =3D=3D NULL)) { IncrementErrorCount (); Print ( L"ERROR: Invalid table entry at 0x%lx, table address is 0x%lx\n", @@ -140,7 +132,7 @@ ParseAcpiXsdt ( // Process the tables Offset =3D TableOffset; TablePointer =3D (UINT64*)(Ptr + TableOffset); - while (Offset < (*AcpiHdrInfo.Length)) { + while (Offset < AcpiTableLength) { if ((UINT64*)(UINTN)(*TablePointer) !=3D NULL) { ProcessAcpiTable ((UINT8*)(UINTN)(*TablePointer)); } -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43645): https://edk2.groups.io/g/devel/message/43645 Mute This Topic: https://groups.io/mt/32439507/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-