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=ZFRBo+f8; spf=pass (domain: arm.com, ip: 40.107.5.49, mailfrom: sami.mujawar@arm.com) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (EUR03-VE1-obe.outbound.protection.outlook.com [40.107.5.49]) by groups.io with SMTP; Fri, 23 Aug 2019 03:57:16 -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=cZR+FSgHYiRws2EF1diUudTo/SgsxqLZWiWS5HL2Tsg=; b=ZFRBo+f8hwwuoNXSed+nLsfIVbNxeYH0blNKhy+6PBhrPBdbevqDlQHQQ/9Gw71q63CuX06A7BQS6KPP13fYsbKwZk7uzF+8A29TCAr/1zP5moQ4K9yukND3+t1Ttml9yirQZb5yR14VvIb6VlZOgke0vyx7E1bkFG5fLDqyq/o= Received: from HE1PR0802CA0010.eurprd08.prod.outlook.com (2603:10a6:3:bd::20) by AM6SPR01MB14.eurprd08.prod.outlook.com (2603:10a6:209:3c::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.18; Fri, 23 Aug 2019 10:57:11 +0000 Received: from AM5EUR03FT054.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::202) by HE1PR0802CA0010.outlook.office365.com (2603:10a6:3:bd::20) 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:57:11 +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 AM5EUR03FT054.mail.protection.outlook.com (10.152.16.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2199.13 via Frontend Transport; Fri, 23 Aug 2019 10:57:09 +0000 Received: ("Tessian outbound 4ee777a495a5:v27"); Fri, 23 Aug 2019 10:57:09 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: fa66d4c7401ee795 X-CR-MTA-TID: 64aa7808 Received: from fb679d1035a9.1 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.14.58]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id AC5B32C6-EEAA-482C-8111-7298D68AA322.1; Fri, 23 Aug 2019 10:57:03 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04lp2058.outbound.protection.outlook.com [104.47.14.58]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id fb679d1035a9.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384); Fri, 23 Aug 2019 10:57:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VgNq0KuVgglOd2uTVYuS4oDLZIt/2HbwrBRzC5Og8kujjkgL/MZkX+WObqDaZ93fTzaOyXIYXdg78FBLSrNbUi8mxR3ud5uycjaWRiBSxunoOTCkmugtpRQ1tjLboNepzj1dAE3gvdXsSOuLslzb/KuvPbb9tJ6+Rn4qi/HUHjaBPaPcesOqATsVzeNfGytYhcNbiqj6e/dslS9rYhffD+z6+CxiSGIdIIucEvYZ806QJVU7uq1hI/aTPyaVnOn5G0Cnjjc4gQd5B4F7jv4PBY0XjdTiM1ltj7nlOavu26l08IeYsB9sCxF4uICH+va2/guOuOA78QBTYN7QhqawMQ== 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=cZR+FSgHYiRws2EF1diUudTo/SgsxqLZWiWS5HL2Tsg=; b=HQnUqucqwUFrpjnvZA+1VIWBTEzkXc46PTLIXqj83oniQOe0I1/XkW365eUZ5hVnOhWH9V74/BjzeCGbxPrDdn/lLst+zR7iAQKHWADobyq07bBAW5+BZ6Cwt1Ovf+tLwmEKk3rzEJ+h/uKdoiXgXJiH+1yTgk+w0EZfHLeGzoC8hhCGy+wtl+OSts8+zryMmSzFtYIjiltfeh8pNqSpSxf0G/bCLwgyL2Q8L2YynuZlVnzxWRTng7bnI2nxCpJpTp+LnoId+SkhDJ1Nvm51gz9PbSt3UHMeD5LBrm5R1ZIn7hE3RRdJb5nm8Q27dZMLJlAkYazz5479wuAX5rgv0A== 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=cZR+FSgHYiRws2EF1diUudTo/SgsxqLZWiWS5HL2Tsg=; b=ZFRBo+f8hwwuoNXSed+nLsfIVbNxeYH0blNKhy+6PBhrPBdbevqDlQHQQ/9Gw71q63CuX06A7BQS6KPP13fYsbKwZk7uzF+8A29TCAr/1zP5moQ4K9yukND3+t1Ttml9yirQZb5yR14VvIb6VlZOgke0vyx7E1bkFG5fLDqyq/o= Received: from VE1PR08CA0019.eurprd08.prod.outlook.com (2603:10a6:803:104::32) by HE1PR0802MB2603.eurprd08.prod.outlook.com (2603:10a6:3:e0::16) 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:57:01 +0000 Received: from AM5EUR03FT011.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::201) by VE1PR08CA0019.outlook.office365.com (2603:10a6:803:104::32) 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:57:00 +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 AM5EUR03FT011.mail.protection.outlook.com (10.152.16.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2199.13 via Frontend Transport; Fri, 23 Aug 2019 10:56:59 +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:22 +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:22 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , Subject: [PATCH v1 09/19] DynamicTablesPkg: Fix unaligned pointers usage Date: Fri, 23 Aug 2019 11:55:29 +0100 Message-ID: <20190823105539.13260-10-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)(376002)(396003)(39860400002)(346002)(136003)(2980300002)(189003)(199004)(2616005)(76176011)(14444005)(86362001)(6916009)(70206006)(70586007)(1076003)(16586007)(81156014)(54906003)(7696005)(51416003)(81166006)(47776003)(316002)(8936002)(8676002)(305945005)(186003)(26005)(36756003)(336012)(50466002)(2906002)(50226002)(4326008)(356004)(5660300002)(2351001)(53416004)(63370400001)(478600001)(63350400001)(11346002)(446003)(426003)(44832011)(53936002)(126002)(48376002)(486006)(476003);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR0802MB2603;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: c7534d67-840f-4291-c798-08d727b8a507 X-Microsoft-Antispam-Untrusted: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(1401327)(2017052603328);SRVR:HE1PR0802MB2603; X-MS-TrafficTypeDiagnostic: HE1PR0802MB2603:|AM6SPR01MB14: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true X-MS-Oob-TLC-OOBClassifiers: OLM:3826;OLM:3826; X-Forefront-PRVS: 0138CD935C X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info-Original: 71PX83e5BDby9npWb1ar2dD8Nl5MVxCZw1nJVgqwy4UxVPblwNbmxf8qxtG9pWzigkuGRto7yax/9LW4XHr0SSDw6SejzZTT0acCFEpVaosnNNWKXUfG2LAUAYcFi8YzmHXFgfncnwiBsnZ/9HNc8ANY1VaY5cjBnzQDyItCbY+m2rxCL/KaGAKBWZ9HOV0hMCKPi7D/zlxpv6npd77T/dHuaKEocsxkJdC3Rltw+7CYGnnfQPeZRMuLJ/ELEOgI5pzmVpzZUMZUVwhuNB5VPq7D8/kXMDNgzsIaEaCLn2poM8uYNQYTqXfjGNa2Dv9jNbcOVnsRON5teDK7+4BTgkEU1q/dYVGqrxytQlbRLXAUzyB4fk029ylKhC+qaHdAXGIG0mtntTBth/ewjWe4NPtkEPhEPs7yeWIitIjExQc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2603 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: AM5EUR03FT054.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)(189003)(199004)(26826003)(36756003)(86362001)(5660300002)(336012)(54906003)(8676002)(26005)(70206006)(70586007)(48376002)(81166006)(50226002)(16586007)(81156014)(2906002)(14444005)(4326008)(50466002)(76176011)(1076003)(6916009)(7696005)(51416003)(63370400001)(63350400001)(446003)(186003)(8936002)(316002)(2351001)(476003)(44832011)(76130400001)(486006)(305945005)(22756006)(126002)(11346002)(478600001)(53416004)(2616005)(47776003)(426003)(36906005);DIR:OUT;SFP:1101;SCL:1;SRVR:AM6SPR01MB14;H:64aa7808-outbound-1.mta.getcheckrecipient.com;FPR:;SPF:TempError;LANG:en;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;MX:1;A:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 336e7bde-92e7-4c4c-5f11-08d727b89eff X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600166)(710020)(711020)(4605104)(1401327)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328);SRVR:AM6SPR01MB14; NoDisclaimer: True X-Forefront-PRVS: 0138CD935C X-Microsoft-Antispam-Message-Info: Ou+9HkmOfw8SIoTNwYvA0SRgnGiXL5ztME699OzxD7cK1FVD6j3FoMtqGBfAhlaLAzASaZVdSaeNkyWGgq1HZvItT21O2J2OFB8OGzqy9A5JDzhF+x25jgQ9iW+OZK0s45B/I+a1arIBmLAxm/ZT+ri5C/mip6bpq7WY0fkz+qM+ShSkg9OvPw5b8hLQitG+yfzfJgJScleUZgxI4tNrXs67L5hdOdO4AVdkwO9xIVusuvvoglwtSZ8Nm0gxO25whwb4f4/pgKzOIUHGTTt1oPSQGwzh5cthbLj07J0StvEtwhUsw0pUu+HJwpX152m8FGWvDbixmLIAog9MFWbJvDXr4GGVN6FHMP446n7ALAXFcsSTyBq4weTS/Mczt93qfNIY2K1dlRlz7rNpeCdGBL1ewFvsDlfpFKlPWuqKtRM= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2019 10:57:09.1700 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c7534d67-840f-4291-c798-08d727b8a507 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: AM6SPR01MB14 Content-Type: text/plain The VS2017 compiler reports 'warning C4366: The result of the unary '&' operator may be unaligned' if an address of an unaligned structure member is passed as an argument to a function. Fix this warning by using local variables in place of unaligned structure members. Signed-off-by: Sami Mujawar --- DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c | 24 +++++++++++++++----- DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.h | 13 +++++------ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c index 40699ce113caa8530c89ac20562cf5abda26b88e..82070403ac8757f54e839fd00eb4acb3292fc60c 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.c @@ -1066,6 +1066,9 @@ BuildPpttTable ( EFI_STATUS Status; UINT32 TableSize; UINT32 ProcTopologyStructCount; + UINT32 ProcHierarchyNodeCount; + UINT32 CacheStructCount; + UINT32 IdStructCount; UINT32 ProcHierarchyNodeOffset; UINT32 CacheStructOffset; @@ -1113,7 +1116,7 @@ BuildPpttTable ( CfgMgrProtocol, CM_NULL_TOKEN, &ProcHierarchyNodeList, - &Generator->ProcHierarchyNodeCount + &ProcHierarchyNodeCount ); if (EFI_ERROR (Status)) { DEBUG (( @@ -1124,7 +1127,8 @@ BuildPpttTable ( goto error_handler; } - ProcTopologyStructCount = Generator->ProcHierarchyNodeCount; + ProcTopologyStructCount = ProcHierarchyNodeCount; + Generator->ProcHierarchyNodeCount = ProcHierarchyNodeCount; // Get the cache info and update the processor topology structure count with // Cache Type Structures (Type 1) @@ -1132,7 +1136,7 @@ BuildPpttTable ( CfgMgrProtocol, CM_NULL_TOKEN, &CacheStructList, - &Generator->CacheStructCount + &CacheStructCount ); if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) { DEBUG (( @@ -1143,7 +1147,8 @@ BuildPpttTable ( goto error_handler; } - ProcTopologyStructCount += Generator->CacheStructCount; + ProcTopologyStructCount += CacheStructCount; + Generator->CacheStructCount = CacheStructCount; // Get the processor hierarchy node ID info and update the processor topology // structure count with ID Structures (Type 2) @@ -1151,7 +1156,7 @@ BuildPpttTable ( CfgMgrProtocol, CM_NULL_TOKEN, &IdStructList, - &Generator->IdStructCount + &IdStructCount ); if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) { DEBUG (( @@ -1163,7 +1168,8 @@ BuildPpttTable ( goto error_handler; } - ProcTopologyStructCount += Generator->IdStructCount; + ProcTopologyStructCount += IdStructCount; + Generator->IdStructCount = IdStructCount; // Allocate Node Indexer array NodeIndexer = (PPTT_NODE_INDEXER*)AllocateZeroPool ( @@ -1475,6 +1481,12 @@ ACPI_PPTT_GENERATOR PpttGenerator = { // Processor topology node count 0, + // Count of Processor Hierarchy Nodes + 0, + // Count of Cache Structures + 0, + // Count of Id Structures + 0, // Pointer to PPTT Node Indexer NULL }; diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.h b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.h index 6a0fdd08e1533c57285f420555586314c70a5ed5..0a14da502d595e27d87262b1bac681318f1d9ced 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.h +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiPpttLibArm/PpttGenerator.h @@ -167,6 +167,12 @@ typedef struct AcpiPpttGenerator { ACPI_TABLE_GENERATOR Header; /// PPTT structure count UINT32 ProcTopologyStructCount; + /// Count of Processor Hierarchy Nodes + UINT32 ProcHierarchyNodeCount; + /// Count of Cache Structures + UINT32 CacheStructCount; + /// Count of Id Structures + UINT32 IdStructCount; /// List of indexed CM objects for PPTT generation PPTT_NODE_INDEXER * NodeIndexer; /// Pointer to the start of Processor Hierarchy nodes in @@ -176,13 +182,6 @@ typedef struct AcpiPpttGenerator { PPTT_NODE_INDEXER * CacheStructIndexedList; /// Pointer to the start of Id Structures in the Node Indexer array PPTT_NODE_INDEXER * IdStructIndexedList; - /// Count of Processor Hierarchy Nodes - UINT32 ProcHierarchyNodeCount; - /// Count of Cache Structures - UINT32 CacheStructCount; - /// Count of Id Structures - UINT32 IdStructCount; - } ACPI_PPTT_GENERATOR; #pragma pack() -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'