From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=gA2G3mwB; spf=pass (domain: arm.com, ip: 40.107.4.40, mailfrom: sami.mujawar@arm.com) Received: from EUR03-DB5-obe.outbound.protection.outlook.com (EUR03-DB5-obe.outbound.protection.outlook.com [40.107.4.40]) by groups.io with SMTP; Fri, 23 Aug 2019 03:56:56 -0700 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=iFT6qtTvunSH9itRRfyJQ2LW8v17ti3AHrkTirnoq3Q=; b=gA2G3mwB9VhTcQzAjLVhEGKTEoq8ROlto7+0dqrN2IVbtgiEM7ZTQGaPGPkaSnh4B1+ZKEg26mXtEgUZGgzvp9YWkKGeYlRcqBWdpJF748uVjHa9HWgx3yI6icJeNg3Lb/zWzjbe4BTWOYSi5QQbEp1Yen2l1Mfzo6/6axGy8II= Received: from VI1PR08CA0220.eurprd08.prod.outlook.com (2603:10a6:802:15::29) by VE1PR08MB4959.eurprd08.prod.outlook.com (2603:10a6:803:110::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.16; Fri, 23 Aug 2019 10:56:51 +0000 Received: from VE1EUR03FT063.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::206) by VI1PR08CA0220.outlook.office365.com (2603:10a6:802:15::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2199.14 via Frontend Transport; Fri, 23 Aug 2019 10:56:51 +0000 Authentication-Results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=temperror action=none header.from=arm.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT063.mail.protection.outlook.com (10.152.18.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2199.13 via Frontend Transport; Fri, 23 Aug 2019 10:56:49 +0000 Received: ("Tessian outbound df6366865adf:v27"); Fri, 23 Aug 2019 10:56:46 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 104b78dda65872ba X-CR-MTA-TID: 64aa7808 Received: from 3fd8dc3cbe16.1 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.2.53]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id A483CBF5-8C08-4DFF-94C9-6E1C7C575AEE.1; Fri, 23 Aug 2019 10:56:38 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01lp2053.outbound.protection.outlook.com [104.47.2.53]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 3fd8dc3cbe16.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384); Fri, 23 Aug 2019 10:56:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CPbfxe8hRxUSY4FCvv0w/a8pY8sK3sGYPR6FMN3Fj8wXm1tHXjQ5hjAV0xCNm15YxH6I96tJyDRPgSNOTc9OI2WRcxx4OsL+LeV2JCK/JhdgCOrRVu01XUn4c2hHdfomWqk648akdCHti1xyduBG3tRhcJStosyH5ocCzYsoAO9Hc2duRKuSI8gSQtH0QELmy+4JAtN7w26S/aFzlH3CfUgaz0J/bb7xUu09WRvQyqbEBKIMOGp7XPn94+mNFHca9KFxCxz0zMCSfS17dh/6G8NkgL/hvtXr5yaRR/rB83X4inD1I0RJ0NCUjdb8aZVLUmD1V1za1AfmKesQYyC+Gg== 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=iFT6qtTvunSH9itRRfyJQ2LW8v17ti3AHrkTirnoq3Q=; b=Rp5dOPhkKkoUKZYGqfodZ8Jz+PbKHWU2ypYWWjrwsAXBFLuoQo6yqrhGPNxjM37eaZAX1P6lv2U8VaUC5n0pQyZtsII/Yoydcx6579ieW1DFWb1C2ldhMeI98GVi9XxjKdJBgdvTUkavC4TpBB+nY+Lx1AIMf7xnII0wiWvQJ1uyJb06HxVg23voz8o2yI3ouJn5KPcUb8R4EXwsYrg2szsf2KyMuLesJikQvV9C/D1S54TOt/IKccYvdvK15ssIX8yAw4psUJSFFWtMAJBTskXPLgn9HhiyIp7cV8RV1n4XBNz26sMJis1E/ptKtnIqks5esiKqxfap+osDx8xoUA== 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 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=iFT6qtTvunSH9itRRfyJQ2LW8v17ti3AHrkTirnoq3Q=; b=gA2G3mwB9VhTcQzAjLVhEGKTEoq8ROlto7+0dqrN2IVbtgiEM7ZTQGaPGPkaSnh4B1+ZKEg26mXtEgUZGgzvp9YWkKGeYlRcqBWdpJF748uVjHa9HWgx3yI6icJeNg3Lb/zWzjbe4BTWOYSi5QQbEp1Yen2l1Mfzo6/6axGy8II= Received: from DB6PR0801CA0046.eurprd08.prod.outlook.com (2603:10a6:4:2b::14) by HE1PR0802MB2604.eurprd08.prod.outlook.com (2603:10a6:3:db::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.16; Fri, 23 Aug 2019 10:56:36 +0000 Received: from AM5EUR03FT003.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::208) by DB6PR0801CA0046.outlook.office365.com (2603:10a6:4:2b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2199.14 via Frontend Transport; Fri, 23 Aug 2019 10:56:35 +0000 Authentication-Results-Original: spf=temperror (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=temperror action=none header.from=arm.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT003.mail.protection.outlook.com (10.152.16.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2199.13 via Frontend Transport; Fri, 23 Aug 2019 10:56:34 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1415.2; Fri, 23 Aug 2019 10:56:21 +0000 Received: from E107187.Arm.com (10.1.195.55) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Fri, 23 Aug 2019 10:56:21 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , Subject: [PATCH v1 05/19] DynamicTablesPkg: Fix Proc node length assignment Date: Fri, 23 Aug 2019 11:55:25 +0100 Message-ID: <20190823105539.13260-6-sami.mujawar@arm.com> X-Mailer: git-send-email 2.11.0.windows.3 In-Reply-To: <20190823105539.13260-1-sami.mujawar@arm.com> References: <20190823105539.13260-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;IPV:NLI;CTRY:IE;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(396003)(39860400002)(346002)(136003)(376002)(2980300002)(189003)(199004)(8676002)(63370400001)(446003)(86362001)(53416004)(426003)(2906002)(11346002)(50226002)(356004)(2351001)(5660300002)(63350400001)(4326008)(81156014)(47776003)(76176011)(48376002)(478600001)(81166006)(44832011)(336012)(70206006)(70586007)(486006)(2616005)(476003)(26005)(6916009)(1076003)(305945005)(8936002)(126002)(14444005)(7696005)(16586007)(54906003)(50466002)(36756003)(186003)(51416003)(53936002)(316002);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR0802MB2604;H:nebula.arm.com;FPR:;SPF:TempError;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 978402be-9d43-4f60-0514-08d727b89924 X-Microsoft-Antispam-Untrusted: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(1401327)(2017052603328);SRVR:HE1PR0802MB2604; X-MS-TrafficTypeDiagnostic: HE1PR0802MB2604:|VE1PR08MB4959: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true X-MS-Oob-TLC-OOBClassifiers: OLM:8273;OLM:8273; X-Forefront-PRVS: 0138CD935C X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info-Original: xTcHcRo57Xe2tP8sqDISM5X+UtsyGcxkj/Uk/qkYkydYlRazkmeITsEfFWh7N3m/b75GCTWattbosY+Tol/zFgBZ1PuLBPi2jGtMqR7lX5X1rulvjgt4yt7y5VqaQcDbp/pOnK3fohc1eHKoYgUVmQK8BWZIwhQSnYvvgEk2Q94ko5nrR0JyH50cZhzkBJvf9/4hShEZ0b0+IqtaczJxNBi7XHw8iJ92+vIT0q1AHhT1qQjvX3uaZKgsseBfF6ziBeyeGDeGQWvYIrt6wtDZCthbdEFhivOoVJXypuMXIxLpYT0BouFX/6720TLgx2imXraEkE7R37aXkFG+IGhy1XOBHQ+6rLSJuE5HnoCNDe156/t5jHFMMuYwaP/b370S5oxeOieqwoDuc28j+lxBmxACGDXIjk2rb3sV+KLTE1w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2604 Original-Authentication-Results: spf=temperror (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=temperror action=none header.from=arm.com; Return-Path: Sami.Mujawar@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT063.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123;IPV:CAL;SCL:-1;CTRY:IE;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(136003)(346002)(396003)(376002)(39860400002)(2980300002)(199004)(189003)(76176011)(7696005)(48376002)(26826003)(51416003)(53416004)(2351001)(6916009)(50466002)(47776003)(486006)(478600001)(446003)(476003)(11346002)(126002)(2616005)(14444005)(44832011)(8676002)(86362001)(22756006)(426003)(63370400001)(336012)(5660300002)(16586007)(316002)(63350400001)(8936002)(305945005)(36906005)(50226002)(70206006)(2906002)(70586007)(4326008)(54906003)(36756003)(1076003)(76130400001)(81166006)(81156014)(26005)(186003);DIR:OUT;SFP:1101;SCL:1;SRVR:VE1PR08MB4959;H:64aa7808-outbound-1.mta.getcheckrecipient.com;FPR:;SPF:TempError;LANG:en;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;A:1;MX:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: b4d9c261-35b6-4480-6b54-08d727b8902d X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(710020)(711020)(4605104)(1401327)(2017052603328);SRVR:VE1PR08MB4959; NoDisclaimer: True X-Forefront-PRVS: 0138CD935C X-Microsoft-Antispam-Message-Info: iUVT9AsB28cc5qtujU/H9sWqUVOs52j4rRgB6Vg8w82uvauaGs5E/1ytVmkFAJmEqkJwdTguEoYObq7DBSHlgVBauMtZz6zjGmatHkeKgLApLiSrHG/Hk6bDsC5RlWkOlRS4wdfC6qUDL9k8k1Cm4YcPrvlbjpFQfDG1aiPQClSc9OvXobmRIVw7ZC+hAX97SZZvSkbSEDMjMkL0PUmHxdB5CP7xMVYJUnUl8m8d78nlzr2sKIId/upSs+TtJeVnB4nx0jB8mVrnPX66d31syW/hOgeMmJnSNlMHsjN9+/ioqqeIANtIe+LZAadUo1pGhVKRMVcahxmXgF356rYXlNJUZn13gC37cCCdV6l1wXj6Aa0qkBpUBWkcKRXpVN7CQ37e/019YlZ+xTQMz/KwJP6e8vmcYDtHKQboaJw2uRI= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2019 10:56:49.1683 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 978402be-9d43-4f60-0514-08d727b89924 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-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4959 Content-Type: text/plain The length field for the Processor Hierarchy node structure is 8-bit wide while the number of private resource field is 32-bit wide. Therefore, the GetProcHierarchyNodeSize() returns the size as a 32-bit value. The VS2017 compiler reports 'warning C4244: '=': conversion from 'UINT32' to 'UINT8', possible loss of data' while assigning the length field of the Processor Hierarchy node structure. To fix this, a type cast is added. In addition, there is a check to ensure that the Processor Hierarchy node size does not exceed MAX_UINT8. Signed-off-by: Sami Mujawar --- DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c index 9e42eee9b75bb330833b0f56c98947563d9eb821..40699ce113caa8530c89ac20562cf5abda26b88e 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c @@ -504,6 +504,7 @@ AddProcHierarchyNodes ( PPTT_NODE_INDEXER * ProcNodeIterator; UINT32 NodeCount; + UINT32 Length; ASSERT ( (Generator != NULL) && @@ -539,8 +540,8 @@ AddProcHierarchyNodes ( // imposed on the Processor Hierarchy node by the specification. // Note: The length field is 8 bit wide while the number of private // resource field is 32 bit wide. - if ((sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR) + - (ProcInfoNode->NoOfPrivateResources * sizeof (UINT32))) > MAX_UINT8) { + Length = GetProcHierarchyNodeSize (ProcInfoNode); + if (Length > MAX_UINT8) { Status = EFI_INVALID_PARAMETER; DEBUG (( DEBUG_ERROR, @@ -556,7 +557,7 @@ AddProcHierarchyNodes ( // Populate the node header ProcStruct->Type = EFI_ACPI_6_3_PPTT_TYPE_PROCESSOR; - ProcStruct->Length = GetProcHierarchyNodeSize (ProcInfoNode); + ProcStruct->Length = (UINT8)Length; ProcStruct->Reserved[0] = EFI_ACPI_RESERVED_BYTE; ProcStruct->Reserved[1] = EFI_ACPI_RESERVED_BYTE; -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'