From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (EUR05-DB8-obe.outbound.protection.outlook.com [40.107.20.72]) by mx.groups.io with SMTP id smtpd.web09.10075.1657817470875482881 for ; Thu, 14 Jul 2022 09:51:11 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=exNbDBFB; spf=pass (domain: arm.com, ip: 40.107.20.72, mailfrom: sami.mujawar@arm.com) ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=X/bWXstvRkgMZ0qmYErjv0f6ikf6MHH7TQXJ8tZr9/ByCQXhsKHUAyIoqpL/KTMm/yqzwDmH54nEtqyuq5yXV6wralvFEASBcRZ84xbFX0133RAk6TvaakcdVzpRx2OByziKtZFxoMuXtyroqeHifQonVVPz3gqw9ahEeb+yttGUAwwo6Gz0QvtWii7YGNXzmzoxM8fam1vODR9Z2A0Cf83IJILMYjy6nyDeCzMP8Dpjn1pHj0UGzFrWjZiEZ8X/fBkwS4vxIZhjIIVzeUgpkLG9s7oaWLpEJcRSN7hShfnwzceRIbOBlUXAOVKBMYxsgUR22lGzxPCm9elgPlv6bw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WX2Y1ZqSUmM6aD2T4+clUSFiX9pKqdghz2S8+tuGMRY=; b=Ga9I1V1Jgjc+59yi1p+I0v06IdpyTfld7JvvaVHza8nc+BBlYv4A2duwPX6KE7KqH/wa3UJLMsm5Qu/4zHZUhm4DeGrHv3z/0I8G1F6EZNUEeBpzCKOZ9b+TU23k/nxffR/p4cwC6RVyusYUJPHCNd1Uww4Jih6bOIKkhdiGlx7D1TRn4dwCyyaEmapQzx1hpFRzKNNJ/8/HGUMPOMB+7Nkpw4W6hmGo1GSnxqDvHcs6t9jKK+F4kfapiqznK83y+Ugs1vhDw94+VB/4t4MItSfcQ8DqtCsdVP7KPAgi5FE8jlN7KV9z4LJ2eWepFRVzvEbNWGRiyo2dBXzPNppdbw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WX2Y1ZqSUmM6aD2T4+clUSFiX9pKqdghz2S8+tuGMRY=; b=exNbDBFBvtpxh6gNpNidvbJ5Y2YaguwF1uCF6kmmFvFPVj+okOur/4O7T4ndDIquzSzHEm5YSks/R94q0Nc5m6Iqk+JJjo28IQqCG9cqbHr+XDt3WmcAWUj9RIDPE2SsnxK+JLR0k6u4HpsBhqsF3xRJflf8Mu1iHfoleoPYHTA= Received: from FR3P281CA0145.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:95::8) by DBBPR08MB4505.eurprd08.prod.outlook.com (2603:10a6:10:cf::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.14; Thu, 14 Jul 2022 16:51:07 +0000 Received: from VE1EUR03FT044.eop-EUR03.prod.protection.outlook.com (2603:10a6:d10:95:cafe::37) by FR3P281CA0145.outlook.office365.com (2603:10a6:d10:95::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.7 via Frontend Transport; Thu, 14 Jul 2022 16:51:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT044.mail.protection.outlook.com (10.152.19.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.15 via Frontend Transport; Thu, 14 Jul 2022 16:51:06 +0000 Received: ("Tessian outbound f9f15f9daab2:v122"); Thu, 14 Jul 2022 16:51:06 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: ea99905d90def7d5 X-CR-MTA-TID: 64aa7808 Received: from b949913eae76.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 0886CAE3-848B-40CA-846C-6110AC3D43B5.1; Thu, 14 Jul 2022 16:50:59 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b949913eae76.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 14 Jul 2022 16:50:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=edSxz4b1go2kvK9l8mnc1dpOq3GyB0SexUXkAUsl9tOwWWGPABp2UCN4eaniXg8f/ImsXjnQCQrlqR1/QuVqifeQVTPp5md/ryzwmvlDBZ+AnebpwXIoa239+x0Ua0ccZiycVSalRBgHXXRlwmEitSEKjHzzLWdaWv8GO2C9x3wI9UZUrTuPL1GQcFXQ5ejVJOpTlQkf77sgZ3n5Li2xhXjHajxALKhUla+nczGuM0Io9aO8tX47lYAmN1jwpkwjXKB/zYkFKrfexqgc2n8FWesFiiNuZbXeHzmPBIhTz/VPBlQnu6U3FG1GKv2HIJS+wtTwQAH7jdW8nQFoSnGofw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WX2Y1ZqSUmM6aD2T4+clUSFiX9pKqdghz2S8+tuGMRY=; b=OFhjKtT8OR6AWp4CD105bJmDGI69AmPwTeVAjtZRTJPQTc2omODeuACukB3kb7RapqbSDb/tAnhUTl4Dg55LUmuRZbVK6VmODqia503/E8G72xjStbg5sgJZkTK4f4XqOOmFB6p+H5kOWgl1VW+FKsGusE8vqh69Z0pM/JOujSg4yPQXtiyqU+vlpaCggeySUlXUy60fwzLvU72YfDKzdWAWirEn5HiIvJ1r8MVyWQH2BiVjDYS8Rc0CMoxyKGhXv37J0sVhAMKmsggViAXWNnJDvf6QWaUkOeMTiL5Im9C/6aMIvhaRQs6ILhBS3iU66Ruil7CWuH33O/XpXUui1g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WX2Y1ZqSUmM6aD2T4+clUSFiX9pKqdghz2S8+tuGMRY=; b=exNbDBFBvtpxh6gNpNidvbJ5Y2YaguwF1uCF6kmmFvFPVj+okOur/4O7T4ndDIquzSzHEm5YSks/R94q0Nc5m6Iqk+JJjo28IQqCG9cqbHr+XDt3WmcAWUj9RIDPE2SsnxK+JLR0k6u4HpsBhqsF3xRJflf8Mu1iHfoleoPYHTA= Received: from AS9PR04CA0078.eurprd04.prod.outlook.com (2603:10a6:20b:48b::25) by AS8PR08MB6901.eurprd08.prod.outlook.com (2603:10a6:20b:39c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.17; Thu, 14 Jul 2022 16:50:58 +0000 Received: from AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:48b:cafe::a8) by AS9PR04CA0078.outlook.office365.com (2603:10a6:20b:48b::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.13 via Frontend Transport; Thu, 14 Jul 2022 16:50:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT059.mail.protection.outlook.com (10.152.17.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5438.12 via Frontend Transport; Thu, 14 Jul 2022 16:50:58 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) 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.2507.9; Thu, 14 Jul 2022 16:50:39 +0000 Received: from E114225.Arm.com (10.1.196.36) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.9 via Frontend Transport; Thu, 14 Jul 2022 16:50:38 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , Subject: [PATCH v6 2/8] DynamicTablesPkg: Handle error when IdMappingToken is NULL Date: Thu, 14 Jul 2022 17:50:25 +0100 Message-ID: <20220714165031.42640-3-sami.mujawar@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20220714165031.42640-1-sami.mujawar@arm.com> References: <20220714165031.42640-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 2b20d0c8-4712-4408-a3a8-08da65b90bc1 X-MS-TrafficTypeDiagnostic: AS8PR08MB6901:EE_|VE1EUR03FT044:EE_|DBBPR08MB4505:EE_ x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: f4/KAA0EH0ao3ljcJ6eIOYJv/pjXv709lyRyqkTiHLpTyy1H0Guy1ocwlXu5Vb4JHNU5DPsWrSwLrqi8s2S3MTx+cEfJE/39RW/tea35HpY0tNr92X+TEZphIWFri1fB26javMtPu9I8TpfhkO7vDWYJaPiIEFLp/5QWvrkGhf4p3XhH5FJWAh85j4Z4uOt0t+eiIwdAzMHRMG0riNv3z2w08awpBv+QV833SJ73gykMmw4VuOke1kP6lQebR8hMzH+6mfmhgu7e0ljXv25A7facfRl4D505MOCzSxmTlO2vItSuk+EJ13aP0TOFUMRG5daihUy3HzB4wt3aIUEnSfvwau/k+BnPe9oJS/t4R652uiH6ZUFzHpTJni3qf7dzVrO1Gs1EWxkwn6fbmqe1O9DVtTG95OEW6JA1TZ44sFsbKn1xrmziwIFxyl3HsQ0XEB+6Y3rjUi14u5krGcZg27RlUSfVSAXrrBKlKwnhGa6Wd0+IdsZf8JtPltD7yv+6K9rqP8DEPLbrC19nyy7g70eF6y1ks8shu0bcdV8vZ5rcesLFb0bp+gDDr7ElD2htR/CnpuNZ7ouGj698/FHkZn4JWm6t7Z9cAAvWUtDd8c6HWEgPYrfuvYSMwAsLNiKetd8hrX3NxxgBPIveQnTZ8R8FWYF9f7pamdZ+mz8JYdjpT8fQCftUt4/rk8116uAehg3Xb7HS+KIlr2+rqMseUkuLx2AfoMq+8czAFw67NkN+YK2VbfPVo9w+TlVYuQZjfBHrE3dSYsD+jDJDN4GgtROd+a3096ELm3bSHxJ1AuwVaYI+AFJFPd93krd5v5yuTYq2PskA/f7tP0bbD+2A6xtWqNjePO6k67VI7VsPUdzXMUm25ApNFW0ky9mf3ONeiToJ5evWWqMl4WiuLYv7rXec4pWF2qZvSSdQWwfcaEY= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230016)(6029001)(4636009)(346002)(136003)(396003)(376002)(39860400002)(40470700004)(36840700001)(46966006)(86362001)(40460700003)(2906002)(26005)(478600001)(40480700001)(6666004)(966005)(5660300002)(82310400005)(8936002)(7696005)(1076003)(41300700001)(2616005)(44832011)(8676002)(47076005)(36756003)(82740400003)(186003)(54906003)(81166007)(316002)(36860700001)(426003)(336012)(6916009)(70206006)(83380400001)(70586007)(356005)(4326008)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6901 Return-Path: Sami.Mujawar@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT044.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 6de88e3a-270a-49c6-1d61-08da65b906b4 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EkqYFe8qFL5naYczCXp6Ff0E5lhgFsmvk9FYeC8BqHVETpWGwTdPuma5QT5laZezqRQVLr7VKS6Mwhm51R/3ViquVyf8miM1bLbiBFQcTcRrhFaJ98QmlGzKMLhIjupeSreYrgMAbhjKjFsZTCt1Il386I5mkI7+36Po3sQwJtIkK5ICXrVBDIMhL7xdSdkmaydRqwdktD+et8BsDHIKHNp67pfJ/EvZjSkmRqflyWVb0t88wr3e5Fw5K+nFhd5edJaN7Uy/oEYYzTRF0yktPA3uW+ErMGeKlP70mrr7Dvt1xESctyq9YsG6ypsR0I5J1GgAWTJEi8sxmCTelqFSVbFt6NbmSIJegXe/MWXK24RonjE7SryRsM3RFUc7dKP+3b+kS+PzyX43fRIdeVlyMzSSsXGhcJbOUVw6HZNVv3KmBnxAPAL9ky61q4tkgqM9Jg6NGx5f+MdwfVibu/4O4sc6dtlOJzbByNtZ3K83WAGyGSzEhF6Qpp7Yqu8ibqWQNBXFs9AHiZjSjojDT+tk+VStGSgD1csKAAYJCqciYEpTzrjAnU/GiMEZzo2cZz6dejvQOr3Aa6o9WU/zOU1tyYZoKwK4VbdhoFngTQiNfQpmohFTmvmGKb5EZdroZi6bgKvmNC1qBG4iOxlQdGaTXOhkCmuBpl76tgHjATyEHiBYQfTdwYlTH0YLqKrxTHsJUNaj5SrQQEjH0DNYp1mPVfp5ubv3KQ6R//zh0Ps7Uf4sbYlUixXO91+AhPzd+K7AcriI/SIwfIkI/jP6W9WN+aW8EVKB37ITOYvzIUHhhEIafHhD9HikdiGi3udB/0Kq6lnD7BCmvWQBEB4jb/sJLmMRfwTNUJqq6PTTBttbGRUOVrS4gCoXXnbEhSUYiXzx5YuicjOMl7M2/3AXYdTBQA== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230016)(6029001)(4636009)(136003)(396003)(39860400002)(376002)(346002)(36840700001)(40470700004)(46966006)(6666004)(41300700001)(1076003)(54906003)(316002)(6916009)(7696005)(186003)(2616005)(26005)(82310400005)(36756003)(86362001)(36860700001)(40480700001)(478600001)(966005)(44832011)(82740400003)(5660300002)(2906002)(70586007)(8676002)(70206006)(4326008)(8936002)(81166007)(40460700003)(47076005)(336012)(83380400001)(426003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jul 2022 16:51:06.5847 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2b20d0c8-4712-4408-a3a8-08da65b90bc1 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT044.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4505 Content-Type: text/plain Add error handling when the IdMappingCount is not zero and the IdMappingToken is NULL. Signed-off-by: Sami Mujawar --- Notes: v6: - No changes since v3. Resending with v6 series. [SAMI] v5: - No changes since v3. Resending with v5 series. [SAMI] v4: - No changes since v3. Resending with v4 series. [SAMI] v3: - New patch in this series. Moves error handling code for [SAMI] IdMappingToken from patch v2 6/8 and v2 8/8 into this patch. Ref: https://edk2.groups.io/g/devel/topic/83600728#76662 https://edk2.groups.io/g/devel/topic/83600726#76661 DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c | 82 ++++++++++++++++---- 1 file changed, 66 insertions(+), 16 deletions(-) diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c index 0f13c32b838bf4fe42b53a1e9c3ce817d74681fb..daf9ff00c3deab4005814bbfcf1650469d1e7d92 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c @@ -1,7 +1,7 @@ /** @file IORT Table Generator - Copyright (c) 2017 - 2020, ARM Limited. All rights reserved. + Copyright (c) 2017 - 2022, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @par Reference(s): @@ -905,9 +905,19 @@ AddNamedComponentNodes ( return Status; } - if ((NodeList->IdMappingCount > 0) && - (NodeList->IdMappingToken != CM_NULL_TOKEN)) - { + if (NodeList->IdMappingCount > 0) { + if (NodeList->IdMappingToken == CM_NULL_TOKEN) { + Status = EFI_INVALID_PARAMETER; + DEBUG (( + DEBUG_ERROR, + "ERROR: IORT: Invalid Id Mapping token," + " Token = 0x%x, Status =%r\n", + NodeList->IdMappingToken, + Status + )); + return Status; + } + // Ids for Named Component IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE *)((UINT8 *)NcNode + NcNode->Node.IdReference); @@ -1011,9 +1021,19 @@ AddRootComplexNodes ( RcNode->Reserved1[1] = EFI_ACPI_RESERVED_BYTE; RcNode->Reserved1[2] = EFI_ACPI_RESERVED_BYTE; - if ((NodeList->IdMappingCount > 0) && - (NodeList->IdMappingToken != CM_NULL_TOKEN)) - { + if (NodeList->IdMappingCount > 0) { + if (NodeList->IdMappingToken == CM_NULL_TOKEN) { + Status = EFI_INVALID_PARAMETER; + DEBUG (( + DEBUG_ERROR, + "ERROR: IORT: Invalid Id Mapping token," + " Token = 0x%x, Status =%r\n", + NodeList->IdMappingToken, + Status + )); + return Status; + } + // Ids for Root Complex IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE *)((UINT8 *)RcNode + RcNode->Node.IdReference); @@ -1242,9 +1262,19 @@ AddSmmuV1V2Nodes ( } } - if ((NodeList->IdMappingCount > 0) && - (NodeList->IdMappingToken != CM_NULL_TOKEN)) - { + if (NodeList->IdMappingCount > 0) { + if (NodeList->IdMappingToken == CM_NULL_TOKEN) { + Status = EFI_INVALID_PARAMETER; + DEBUG (( + DEBUG_ERROR, + "ERROR: IORT: Invalid Id Mapping token," + " Token = 0x%x, Status =%r\n", + NodeList->IdMappingToken, + Status + )); + return Status; + } + // Ids for SMMU v1/v2 Node IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE *)((UINT8 *)SmmuNode + SmmuNode->Node.IdReference); @@ -1361,9 +1391,19 @@ AddSmmuV3Nodes ( SmmuV3Node->DeviceIdMappingIndex = NodeList->DeviceIdMappingIndex; } - if ((NodeList->IdMappingCount > 0) && - (NodeList->IdMappingToken != CM_NULL_TOKEN)) - { + if (NodeList->IdMappingCount > 0) { + if (NodeList->IdMappingToken == CM_NULL_TOKEN) { + Status = EFI_INVALID_PARAMETER; + DEBUG (( + DEBUG_ERROR, + "ERROR: IORT: Invalid Id Mapping token," + " Token = 0x%x, Status =%r\n", + NodeList->IdMappingToken, + Status + )); + return Status; + } + // Ids for SMMUv3 node IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE *)((UINT8 *)SmmuV3Node + SmmuV3Node->Node.IdReference); @@ -1476,9 +1516,19 @@ AddPmcgNodes ( return Status; } - if ((NodeList->IdMappingCount > 0) && - (NodeList->IdMappingToken != CM_NULL_TOKEN)) - { + if (NodeList->IdMappingCount > 0) { + if (NodeList->IdMappingToken == CM_NULL_TOKEN) { + Status = EFI_INVALID_PARAMETER; + DEBUG (( + DEBUG_ERROR, + "ERROR: IORT: Invalid Id Mapping token," + " Token = 0x%x, Status =%r\n", + NodeList->IdMappingToken, + Status + )); + return Status; + } + // Ids for PMCG node IdMapArray = (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE *)((UINT8 *)PmcgNode + PmcgNode->Node.IdReference); -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'