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.78]) by mx.groups.io with SMTP id smtpd.web12.29111.1585494863867586025 for ; Sun, 29 Mar 2020 08:14:24 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=RWuzt6Wi; spf=pass (domain: arm.com, ip: 40.107.5.78, mailfrom: sami.mujawar@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=nz1UXdYT99yreTIS8HanM9LVNXPaMAasqg6/uYPCSbk=; b=RWuzt6WiReV8ohBfEWlburBtt1rmFvFvkNnBgvDf4BYdNmGQOCNDnGxnXS9TZ8qiBVd0TTICQT5ozCFzaSi3ELeLOKfP846SztLgVoaBmBh9a5wPkN/YgbJOPTD30sfY5YjZQe9JZyUhAlrKMhR0YBcjGEQDl2u2wPRYhlyd1fw= Received: from AM6PR04CA0068.eurprd04.prod.outlook.com (2603:10a6:20b:f0::45) by VE1PR08MB4815.eurprd08.prod.outlook.com (2603:10a6:802:a3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.20; Sun, 29 Mar 2020 15:14:19 +0000 Received: from AM5EUR03FT030.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:f0:cafe::8c) by AM6PR04CA0068.outlook.office365.com (2603:10a6:20b:f0::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.20 via Frontend Transport; Sun, 29 Mar 2020 15:14:19 +0000 Authentication-Results: spf=pass (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=bestguesspass 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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT030.mail.protection.outlook.com (10.152.16.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.17 via Frontend Transport; Sun, 29 Mar 2020 15:14:19 +0000 Received: ("Tessian outbound 66307db0259d:v48"); Sun, 29 Mar 2020 15:14:19 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a482c9027290c7a2 X-CR-MTA-TID: 64aa7808 Received: from 371f161e133e.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id D12894A4-D79C-4CC0-8729-AAFF4D76CCDC.1; Sun, 29 Mar 2020 15:14:14 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 371f161e133e.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Sun, 29 Mar 2020 15:14:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XQIiEpRqyiIOC6kljUhyZcEMTkV6RUbziv5/ZTwYdjUI/rXO0cIBaj4GUj3BE755UYF6BwLGHXHYnYHUN/jo1DaFcqZWsGQuNMBUXdx79m2ebmhqyzSjbX0yIfZV+bCHb/OmYLCKsdztB7JJZbZxfyUMceEER5ym5S5nuAoVETghhrYKth3anZ72HnIRfwgEFU9byVdPeCgFB45ValW78T73Z+cyeLDwt/vnB/hpL2IiJNvcr4WO5AD34l5gO5wz5XgCO1fhM/lmcwYksa5/6NPQA/b5aAqbWLQL6w6w/E5DOIoT44pc/r4OwU9hHbkv3Y10uf8R5hBDzmLZGaUirQ== 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=nz1UXdYT99yreTIS8HanM9LVNXPaMAasqg6/uYPCSbk=; b=CMubaA9+lrkgVxlmaX30xJdc24ILx0EzyQUDGejtM2k1BpV9zbPeJjPJtcsc1BYCcJphds18zRWykPRkf1Fliin6DVBXdkP7oMZPQEIfNWelUAxSLexP94Dl9PrwfwH2DFDS5nienDG+1NjY3aPEdizQZ6pP77cK3AxQuchmx7zcD375LRX6T5H2br23GvRHGO1kqF6agUgWTKo+UvgfWrkYWEw5cKHx1fljn7Xazh8BDw43zegFEJOyvAHbA87IuKsrzBoB09fuT6f0BOC1dTKpPUgO92nICGpfROH39KCySB0pDufXtoP/9TqkxpUh1/lZvQy7jCWCwEQLV/bppQ== 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=bestguesspass 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=nz1UXdYT99yreTIS8HanM9LVNXPaMAasqg6/uYPCSbk=; b=RWuzt6WiReV8ohBfEWlburBtt1rmFvFvkNnBgvDf4BYdNmGQOCNDnGxnXS9TZ8qiBVd0TTICQT5ozCFzaSi3ELeLOKfP846SztLgVoaBmBh9a5wPkN/YgbJOPTD30sfY5YjZQe9JZyUhAlrKMhR0YBcjGEQDl2u2wPRYhlyd1fw= Received: from AM0PR01CA0019.eurprd01.prod.exchangelabs.com (2603:10a6:208:69::32) by HE1PR0802MB2186.eurprd08.prod.outlook.com (2603:10a6:3:c2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.20; Sun, 29 Mar 2020 15:14:11 +0000 Received: from AM5EUR03FT055.eop-EUR03.prod.protection.outlook.com (2603:10a6:208:69:cafe::c7) by AM0PR01CA0019.outlook.office365.com (2603:10a6:208:69::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.18 via Frontend Transport; Sun, 29 Mar 2020 15:14:11 +0000 Authentication-Results-Original: spf=pass (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=bestguesspass 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; Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT055.mail.protection.outlook.com (10.152.17.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2856.17 via Frontend Transport; Sun, 29 Mar 2020 15:14:11 +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; Sun, 29 Mar 2020 15:14:07 +0000 Received: from E107187.Arm.com (10.57.20.21) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Sun, 29 Mar 2020 15:14:06 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , Subject: [PATCH v2 13/16] DynamicTablesPkg: IORT: Fix uninitialized memory usage Date: Sun, 29 Mar 2020 16:13:50 +0100 Message-ID: <20200329151353.14096-14-sami.mujawar@arm.com> X-Mailer: git-send-email 2.11.0.windows.3 In-Reply-To: <20200329151353.14096-1-sami.mujawar@arm.com> References: <20200329151353.14096-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;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFTY:;SFS:(10009020)(4636009)(346002)(136003)(396003)(39850400004)(376002)(46966005)(186003)(47076004)(82740400003)(54906003)(316002)(70586007)(70206006)(26005)(4326008)(2616005)(356004)(6666004)(44832011)(336012)(1076003)(7696005)(426003)(8936002)(86362001)(478600001)(2906002)(5660300002)(81156014)(36756003)(8676002)(81166006)(966005)(6916009);DIR:OUT;SFP:1101; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e923e5b7-1faf-42bc-b4b1-08d7d3f3da99 X-MS-TrafficTypeDiagnostic: HE1PR0802MB2186:|VE1PR08MB4815: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:6108;OLM:6108; X-Forefront-PRVS: 035748864E X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 4+nc1UPGYkvKtSGkNXMfG5Tz2p1Nfq8phkflQE1jo1WYp4AK3tfBi9a2/XQ0Q8XR6wRlEtZASOLXpgBQ+6Fk2u/CZTnq1HyV6W4puQUc+9d853AbhSdHpbupj32w5ZUgKH0IBAC5dz40NWcpvr3IGpzV3b0U2eMUirGpXq1HElvzNie1bDVGgnGWRrUIxka1nDPJzmePdhYFi0gjZfSPjOjzIi7FuRoUDtEPJQD+HfGAnWAheK3O5AisXXy06/xWc/sREsV66XQ1LqvYMGhHcjPF3h6VCA/GMrb5U8gQUk6h6vDBshul0vEr/HnShIUGcsuTbkXSlfi5mCir/c/zfg78Mh6AQZrMp2Deus29waZMT410Uyd5nlk9/idh9rEQNht0GZj5kdIu9J+/vhqtNGOPJEKhrjUco8KY9VIlePd9xGwNXtovgfKRNFKWCZK0RV4X5A9SdTvdEWftLMqtCmdJeueT0V46iZUZEG5znqTZmBG5W0nKe2wj/QYAMuyjnIfuhfI+lot2laOBb4cuDviEloyXIC7oZLErUl8u1O3E4Q5pLM7z0Js66NwP6fEF34A0/9s9b3ulGFgOOa9wjJG19mPWVZ34CxMQqyopM7M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2186 Original-Authentication-Results: spf=pass (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=bestguesspass action=none header.from=arm.com; Return-Path: Sami.Mujawar@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT030.eop-EUR03.prod.protection.outlook.com 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;SFTY:;SFS:(10009020)(4636009)(136003)(396003)(39850400004)(346002)(376002)(46966005)(82740400003)(26005)(186003)(316002)(5660300002)(54906003)(4326008)(47076004)(478600001)(966005)(8676002)(81156014)(26826003)(81166006)(6666004)(7696005)(8936002)(2906002)(6916009)(70206006)(70586007)(44832011)(86362001)(36756003)(426003)(336012)(36906005)(1076003)(2616005);DIR:OUT;SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 98c49616-bba2-410a-284c-08d7d3f3d5ae X-Forefront-PRVS: 035748864E X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FUMFycB14WiyZB/wTwSRY01/hmlcTNoJmce2SaIG+AF0YubgAYJmphMueBX5iEYSsww397i0HKzHPJCH63JB0dw+daOyAZRX594eYCKvxbBbByp2fYH1UgRS4Wpuj41byXYuXfEDBgi1r868zOJdQbp+mp9MczoSJbfiPfclX0brcq0ZK8Uzam0fS/lEFHa5lfKltuDfDTbzgz2i8Hke2D8v/BfqzVYfFn9apzehCwdaTe5aPqoOzeJy82jIP7SptSTgame2RZb6x1hPUdRjR6smKS01LJkZoxHQqjT4VWJP7M8+3u9BUrMNm9JLYOrdQM9RGCRHptins2q5yEc27L8pSSfAKcl1Xpo8fV/k2bLORGB0IkvEhwDcnxySr2jj0OKU+nKxrXRmxGznwSsybnkavlyu9a54abLscVsFzQIVk+NGHYE0QSFlLOmzoH8ymeVTX0TDiumvqVspZJdFncG1vwZRe8HBoQd0I8Qt38NrEd/wnNLPhTZ9Qa0kTgvzT5EMZuZFRy8dyMlt1RrpdVC6tBGKDUZdFBUHhr0obuHOkfXclChuKYfX59jA/8TfjvePljSjLuNmoe80GWZuVuEgpUG7rqu2QtwQryatAL0= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Mar 2020 15:14:19.3584 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e923e5b7-1faf-42bc-b4b1-08d7d3f3da99 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: VE1PR08MB4815 Content-Type: text/plain On enabling the /analyse option the VS2017 compiler reports: warning C6001: Using uninitialized memory. This warning is reported as some variables that were being logged were uninitialised. To fix this, moved the logging code after the variables being logged are initialised. Signed-off-by: Sami Mujawar Reviewed-by: Alexei Fedorov --- Notes: v2: Splitting patch series and re-submitting DynamicTablesPkg [SAMI] patches from https://edk2.groups.io/g/devel/message/46261 DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c | 96 ++++++++++---------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c index bd71220ca19679792de2bb6d88eed8d1913a7600..65d006c89e668c8b2b8a14326cddf1b69979597f 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c @@ -1738,6 +1738,14 @@ BuildIortTable ( goto error_handler; } TableSize += NodeSize; + + DEBUG (( + DEBUG_INFO, + " ItsGroupNodeCount = %d\n" \ + " ItsGroupOffset = %d\n", + ItsGroupNodeCount, + ItsGroupOffset + )); } // Named Component Nodes @@ -1760,6 +1768,14 @@ BuildIortTable ( goto error_handler; } TableSize += NodeSize; + + DEBUG (( + DEBUG_INFO, + " NamedComponentNodeCount = %d\n" \ + " NamedComponentOffset = %d\n", + NamedComponentNodeCount, + NamedComponentOffset + )); } // Root Complex Nodes @@ -1782,6 +1798,14 @@ BuildIortTable ( goto error_handler; } TableSize += NodeSize; + + DEBUG (( + DEBUG_INFO, + " RootComplexNodeCount = %d\n" \ + " RootComplexOffset = %d\n", + RootComplexNodeCount, + RootComplexOffset + )); } // SMMUv1/SMMUv2 Nodes @@ -1804,6 +1828,14 @@ BuildIortTable ( goto error_handler; } TableSize += NodeSize; + + DEBUG (( + DEBUG_INFO, + " SmmuV1V2NodeCount = %d\n" \ + " SmmuV1V2Offset = %d\n", + SmmuV1V2NodeCount, + SmmuV1V2Offset + )); } // SMMUv3 Nodes @@ -1826,6 +1858,14 @@ BuildIortTable ( goto error_handler; } TableSize += NodeSize; + + DEBUG (( + DEBUG_INFO, + " SmmuV3NodeCount = %d\n" \ + " SmmuV3Offset = %d\n", + SmmuV3NodeCount, + SmmuV3Offset + )); } // PMCG Nodes @@ -1848,6 +1888,14 @@ BuildIortTable ( goto error_handler; } TableSize += NodeSize; + + DEBUG (( + DEBUG_INFO, + " PmcgNodeCount = %d\n" \ + " PmcgOffset = %d\n", + PmcgNodeCount, + PmcgOffset + )); } DEBUG (( @@ -1859,54 +1907,6 @@ BuildIortTable ( TableSize )); - DEBUG (( - DEBUG_INFO, - " ItsGroupNodeCount = %d\n" \ - " ItsGroupOffset = %d\n", - ItsGroupNodeCount, - ItsGroupOffset - )); - - DEBUG (( - DEBUG_INFO, - " NamedComponentNodeCount = %d\n" \ - " NamedComponentOffset = %d\n", - NamedComponentNodeCount, - NamedComponentOffset - )); - - DEBUG (( - DEBUG_INFO, - " RootComplexNodeCount = %d\n" \ - " RootComplexOffset = %d\n", - RootComplexNodeCount, - RootComplexOffset - )); - - DEBUG (( - DEBUG_INFO, - " SmmuV1V2NodeCount = %d\n" \ - " SmmuV1V2Offset = %d\n", - SmmuV1V2NodeCount, - SmmuV1V2Offset - )); - - DEBUG (( - DEBUG_INFO, - " SmmuV3NodeCount = %d\n" \ - " SmmuV3Offset = %d\n", - SmmuV3NodeCount, - SmmuV3Offset - )); - - DEBUG (( - DEBUG_INFO, - " PmcgNodeCount = %d\n" \ - " PmcgOffset = %d\n", - PmcgNodeCount, - PmcgOffset - )); - if (TableSize > MAX_UINT32) { Status = EFI_INVALID_PARAMETER; DEBUG (( -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'