From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (EUR03-VE1-obe.outbound.protection.outlook.com [40.107.5.79]) by mx.groups.io with SMTP id smtpd.web10.4300.1657101453631346130 for ; Wed, 06 Jul 2022 02:57:34 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=1nhWwROz; spf=pass (domain: arm.com, ip: 40.107.5.79, mailfrom: sami.mujawar@arm.com) ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=RYPMV8Fi8GL0efE60B4ZYoCQZdj2F1Cc8BnpLJxI7qzqHQRKMKNI6DlUl4h+WFT6bCemmZbNCrQVQTrtoTpRJCzUlFApfBghV/um/Dw/QohaMXtWegM/yGHA3m+V4HH13ElOTl3B0Vw5vcDSSundDZF+QSRJBC4lOCoHP2hkmM/cf7pkqSeiMRiuRSSjTxq0QgpgBG3OLNKdlbP1v2cgsiA1D8lS+X8G4huNx/veNSaD8fbSwq613zUM4AtKrKRvgx5M7GgNu5KBfu2vLd7STwPan+SP4RfRaFfNvDZjSMs3t7qef6ElCryu/73qvPGJYQLPQNSjXFCbqBc3ZRBWVw== 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=MuXu7SFwk1UZcjXhwVF/BSMRDugmmumPDavVByBDjdI=; b=OZiM4SfsYekviifPTa8A9QGFsbtJVPYw59yH2akOSw2qMxnOs1H6juZKaxdU5MA+tGNnlIUea/xd9IJ6mGlt88c6Xr1v3H8aXkr5xy0T+/i2+RbLlFljR2dfuFbPYNaRdLhWTitX7ZKCD65O261UiaUr46Ya2QjWGSrD+4jE/Mi4rDAux9CKQkK4rzHDpCXrWKdYhhxaRFXMVe+Xc2PqJJ9rLjl5qCu15xcpTkZMN11rzfKw0dZLN2qwEQo1fqrQXdT654Jff2RQqiApW1z4j1jfKrttjYGJpCydloYekcxlty8JFzM+XdFl9XeGXeLqFWNMqVTMMy2ROcLmpxjYDQ== 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=MuXu7SFwk1UZcjXhwVF/BSMRDugmmumPDavVByBDjdI=; b=1nhWwROz96ABd3GHxHyUxmTyOfL4jyfI25NbW+X/aJcr6dVZ9MDYfoL6Ncd0AwA4uGMnGgXPkrmvDlM+L7Cjw9ITlB0ITJTOYFU1cOiCvjNc+izXUAhK9VcoMmRrHp1VvYWqaOMy73SM5KRm8rO2XJIM4IefQ1RshKGpN6asFFQ= Received: from AM6P194CA0070.EURP194.PROD.OUTLOOK.COM (2603:10a6:209:84::47) by VI1PR08MB3200.eurprd08.prod.outlook.com (2603:10a6:803:47::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.16; Wed, 6 Jul 2022 09:57:24 +0000 Received: from AM5EUR03FT034.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:84:cafe::52) by AM6P194CA0070.outlook.office365.com (2603:10a6:209:84::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.16 via Frontend Transport; Wed, 6 Jul 2022 09:57:24 +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 AM5EUR03FT034.mail.protection.outlook.com (10.152.16.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.15 via Frontend Transport; Wed, 6 Jul 2022 09:57:24 +0000 Received: ("Tessian outbound afad550a20c6:v122"); Wed, 06 Jul 2022 09:57:24 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 3d982907693263f0 X-CR-MTA-TID: 64aa7808 Received: from 6668b3d12722.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 5F954DAF-CF59-40D4-9F62-CEC1F1249D70.1; Wed, 06 Jul 2022 09:57:17 +0000 Received: from EUR03-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 6668b3d12722.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 06 Jul 2022 09:57:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c1Gk3lZf1fqhrr8aYhd0ul771MIk2JfsBv1scBAaRkha+2mhSbGR9eKopEm90kXtCyc2ee4ZOCAymIQ8bpP/AgfP+YT1eYTh6XOnpKTBgDMgp4aC2mSaRVGuvN/1+2Rc+mskUfW8BEImcCDxNRbFZ94jfQY0SpjmY3p+KYaF/QurSx9EIi6HoSBDvVUbIimmuON+VwM959IATF9fr0SZcUtFXE+sWeI/DARB0oJ2FgbAYPl4XTjRU+XgIfUELs+Ag1mj+BFqA0dIjCKWYGlZejvzbF/Zrn5pvm/zRI3xt/ouF8vwCt5g9/RnSRu/cxmQ8acUS1YiMf9cTO5//rYL4g== 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=MuXu7SFwk1UZcjXhwVF/BSMRDugmmumPDavVByBDjdI=; b=amtRj80Z/3tSiESZi52TvCPhXr6soA34Gt+OUSKdOk38VxHQ9xz/Lex0IMDoMT6HDLsefxcemoZLuqVR8WLFf8kcu89crxXSC+xfvPVuNBPqpcwT3jcG6gGgWnKIM8h5CMn+5T0nZmdGk5hQbnwTCpG7HD0fLZOteEz+9Tv5Uq4UAdy3jS1TzNKbmvhWY4u1JbTI8HftRM6iQOWtOl28+rkO0cYqaCHdieySgogV25Dzk8ElCmFhJ9o3IMAA3lOITY2cwg4I4mxqL3ZofP/xM8k+I6g9F1fyydiwxF+0AOCWZkIfusYAX32B2Mw2jduJr6nr3lydLn7g/1+cNCYGaA== 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=MuXu7SFwk1UZcjXhwVF/BSMRDugmmumPDavVByBDjdI=; b=1nhWwROz96ABd3GHxHyUxmTyOfL4jyfI25NbW+X/aJcr6dVZ9MDYfoL6Ncd0AwA4uGMnGgXPkrmvDlM+L7Cjw9ITlB0ITJTOYFU1cOiCvjNc+izXUAhK9VcoMmRrHp1VvYWqaOMy73SM5KRm8rO2XJIM4IefQ1RshKGpN6asFFQ= Received: from AM7PR04CA0001.eurprd04.prod.outlook.com (2603:10a6:20b:110::11) by AS4PR08MB7507.eurprd08.prod.outlook.com (2603:10a6:20b:4f9::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.21; Wed, 6 Jul 2022 09:57:15 +0000 Received: from VE1EUR03FT039.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:110:cafe::84) by AM7PR04CA0001.outlook.office365.com (2603:10a6:20b:110::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.21 via Frontend Transport; Wed, 6 Jul 2022 09:57:15 +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 VE1EUR03FT039.mail.protection.outlook.com (10.152.19.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5395.14 via Frontend Transport; Wed, 6 Jul 2022 09:57:14 +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; Wed, 6 Jul 2022 09:56:35 +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; Wed, 6 Jul 2022 09:56:35 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , Subject: [PATCH v4 4/8] DynamicTablesPkg: Handle error when IdMappingToken is NULL Date: Wed, 6 Jul 2022 10:56:27 +0100 Message-ID: <20220706095631.27196-5-sami.mujawar@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20220706095631.27196-1-sami.mujawar@arm.com> References: <20220706095631.27196-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: a578d559-41cd-4313-3760-08da5f35ed49 X-MS-TrafficTypeDiagnostic: AS4PR08MB7507:EE_|AM5EUR03FT034:EE_|VI1PR08MB3200: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: zG1ckwGfy1F93nocxGi0EvoUqoRNrtXJTVuW1hBL+DP4IlTNg75iR4pdFVHdbc+jcpEi4mqJBPyzqOwGyg1nUezGKEC6Nk9CUh0HMZ6wRwALcTdBaqUSJ6pGkoWZQhhyKNrdl2t3TK4Bps6iMIkZoYvZWVgwVqdAd/ekz6IrrQSQ2sktnUW7ochi5UaMOX4yGp+mYcOVMkKukVOo2w2t7+F6n2Tmf82bJ3BhG1NQWIiesyRnbop+KYocRYLQ+h6sFrdAv5qfEmbcnksTv1i9am2xgiLZiUvYmspMD8J07xLl6gk7xBFyQDhDBcVLj9xFJyataPyRaGcu/9ngF+6b/CV6zCfl9trDDrwC8TLrMQLCyhiW53TJfSi/bpl108isWwx14EKBR6f6Vnzs0KIBSXc8/ZYiAi8mJQFAw6FcN4pwj68IGNTQ7g4Zckg2czihesPX1RwGtyUiGPDjCzB4jsw737MInzHFQuMLXmw/F7MHERNusbU4DPmh4m/sUwGw8wtpf1wCS6jdA24dn0NBdHeycuppwBNHmEPEVxLl4rdbyW/4h4ij7KXLv25JnDEb6zh2NweUjcbwUmNpqdZquNnbtscwlSyDl5/fU7buPrtY4o53Jl4eCaobI8kQIQovf7d7CC4qaMW2McKi2qB/KvGP1IP2WqDNyMjBeC1bhblz1ys25lb0o9MjeZGuEjt7nTcZqyoyrNRIbi+JI7MBZJHHud2o6FkxOuNPLU7i9qTXN0oRSy0ECDEhkkiNPEhZMWMcIPMVhTbti3fGXLdjw6b0tsseZbDRuV1B2zOwI21EqUM5lbEIIs2qUKnIbkSCMq9Xx9zCCfSTZIFOCacl2Y9IEzuCC6w2luxHNmqKcf8tojr6wDGK4WtyYlz+giW0ahlYRpiaSA5cp6diYn6UBrzDXs9qIYDWHOcWv5O0haw= 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)(39860400002)(136003)(396003)(376002)(40470700004)(46966006)(36840700001)(186003)(40460700003)(81166007)(26005)(83380400001)(41300700001)(2906002)(336012)(426003)(6666004)(54906003)(316002)(36756003)(7696005)(47076005)(6916009)(966005)(1076003)(8936002)(82740400003)(36860700001)(5660300002)(40480700001)(86362001)(2616005)(82310400005)(44832011)(478600001)(4326008)(8676002)(70586007)(356005)(70206006)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR08MB7507 Return-Path: Sami.Mujawar@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT034.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 4afd27f7-4140-4877-4064-08da5f35e79a X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4MhWl/swqyXV3G+9AneVgUbAyOcceeomH5UPvJDueClvbQFS32wCLYqrogY6Mf8bqcbi4m00WoNIwCIbUuWIE0zg4DAWgzGbvOZtkEiIoLfIkUTD+qdJSRSLMrS3ezVaNTubJtBelDizAhDkDHtG8LshHGdT1nB+lCafdf0hUutw+HQ5gX4BozXW58iTCxsRIsRRFiA3ISIWsT8ojdcgsP3ASS7yVpm0bJM2H9rBUoNxeNDk/7LKLzO/XKc5NQ7ZDylFX3005XfGZ/yy3dknwf5H5uUU8QMtnPzRenhdXW6L354v/jbVLRofJNNNMn0lld8RULIo0viUZtOOzCIqUxjY3cyW70gxdNVK5QZtUa6P/AF6K3GPPSuI1YNgENrW7YFdXqymtxkbnCOxJi0tESaHPPCDvi18zi69iQD1TeRKbqVDFy7ObQf6AKBd+tF5HGVkbKqU5YGWR6ZYqK0b5MmPpO1tukVCZ3Qn8nN4LOs6LAlj/8vu3WBL3zH91cRjoKI88dWDxGlyHL8s8k7LMdmUhbo+lhnSknkaZz3+AcmizyxUhQ1hdzIeyNZfmOmmSPdrjB/fJcHEOBIlKqn5QHHgCM+rbvyHNPljrqGSDA6OgSrz2gXJpeg0oMUkcjliLkSX8wE+y5NUj1br3+TYGoiVvUBKMe+5jZcSNw9bfhHysbdrTrkIiezVrKrZ7c4GbsHzUu0OLLeBKfmQoylrucDy+KZo1xTN1A8ShwJbrZ9K+vO7dzWMIBf2qMb6vO3cmQ+69syvOUv4c6fa3k4sgur480zR/I0DTcmwSogkKiFqf95+HVDSSTGDraRNrYOBNGl3oFPmIapm9MTj1Ob5qQwUgcgOg5Y00bNBK7TN5/mfLXaTG9FPui8raaupLbrW/R9IvSHIqDAqtcS8UqYNiw== 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)(39860400002)(396003)(346002)(376002)(136003)(46966006)(40470700004)(36840700001)(966005)(2616005)(1076003)(8936002)(6916009)(26005)(54906003)(316002)(82740400003)(81166007)(478600001)(82310400005)(86362001)(70586007)(70206006)(36860700001)(40480700001)(40460700003)(426003)(336012)(47076005)(186003)(83380400001)(8676002)(4326008)(44832011)(41300700001)(36756003)(2906002)(7696005)(5660300002)(6666004);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2022 09:57:24.4781 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a578d559-41cd-4313-3760-08da5f35ed49 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: AM5EUR03FT034.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3200 Content-Type: text/plain Add error handling when the IdMappingCount is not zero and the IdMappingToken is NULL. Signed-off-by: Sami Mujawar --- Notes: 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)'