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=6MoKAoNa; spf=pass (domain: arm.com, ip: 40.107.5.40, mailfrom: alexei.fedorov@arm.com) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (EUR03-VE1-obe.outbound.protection.outlook.com [40.107.5.40]) by groups.io with SMTP; Fri, 23 Aug 2019 04:48:37 -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=egvjc70lGYF19j3Izixw2Fogr1wJandipMMuS2Ka19s=; b=6MoKAoNagvAu7cBLlG57HIlX28C+DGJ9FrMTdpEHozrYxZW1CSXKSgxT4jlsRT8a6E17IycuZ1ww6ajP4/sppStTEhH15HkSMweIBl62qty579XeufXpB3ntJh5veX/ipPtIJaxHyjZZZFyrSBhUpoOshejNguY5YbzWwQfDlQU= Received: from DB7PR08CA0034.eurprd08.prod.outlook.com (2603:10a6:5:16::47) 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 11:48:33 +0000 Received: from AM5EUR03FT035.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::201) by DB7PR08CA0034.outlook.office365.com (2603:10a6:5:16::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2199.15 via Frontend Transport; Fri, 23 Aug 2019 11:48:33 +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 AM5EUR03FT035.mail.protection.outlook.com (10.152.16.119) 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 11:48:31 +0000 Received: ("Tessian outbound 3aa685aedf5f:v27"); Fri, 23 Aug 2019 11:48:31 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 7e0c92265187050c X-CR-MTA-TID: 64aa7808 Received: from 7353bf8963c9.1 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.4.53]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id C7824577-B0BC-46AA-8B8F-A5AF0F80D020.1; Fri, 23 Aug 2019 11:48:26 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-am5eur02lp2053.outbound.protection.outlook.com [104.47.4.53]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 7353bf8963c9.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 23 Aug 2019 11:48:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YqRuCHclVelDG2bHbBEgVXDW3mvCoo7o5N0h5ptify5s//SeC6Xu71oosDO1NyH4cpYBSkKdfZdaX9ixcIUE3HoAILjrZCxKnRXO/5qyVnGZMUok8hkdAG3nBY01xqRDxQNXoC1Vb5ZhcqIVrnyS0nkexCLw1YT1gfLx/Ud1Y+AjTSCdg83+kZj6BhSeti3vye2xiickzvTj32oSzGRF8mxin18mqIJl37jFXe8mNBrcJ3J0AeKuMgJV0quASVUDWqQNhI9hSyg6gamtf5LPZ/SbhFipL9ccwCMAFhvfE41q+LN1wUvLbga6qR4QRwHXuHJkw7vAPzFAChVJLZe8RQ== 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=H9JslnwfFGg6qfdCLo4hfq4gTxgBaFtfX2fZVrPnmU8=; b=EyC8CzBUQ8ypoNrg002vvuIRtyZVwFHanAegX64W+uxJGjRobCVwT9u0/3vZxeMPjyCtnDOoFXdQ4OyjX2UPc1VsezIzIK4KYxnKglaerTaaU4hDr49loj+36CK3VaGcgpMnB0a4kLu8qEKGsxtDiynlBe9C8M2kYuHx9fR3e8U0yb8BVfzGn5zlSUKUTkAisnKMqLsyXWs5Ye39Fs3MX2HRtzmGsdAXYjVMHYm4p6JKjcGnW2LmmQ+uXpAO6mMfuE/P99Nh/l+CuJksREDidUrQ2BdvV6WPSk+a1RDzwnM09HSpLbMfjbkiq0cLuap70+YaHHzGjy3mGQfomyCb9Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; 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=H9JslnwfFGg6qfdCLo4hfq4gTxgBaFtfX2fZVrPnmU8=; b=5OsqCbNhOrvvtLifluTS9laFEn8qF7oFF2Nvnk0t3LcSUn1bVIBIg9+xNO/nHUO2z+FmrMd7lYx58h/hTVTprQ8EIwd3oEV1e1Ju7rJ8oA5+5XCaE/+MkfezndtnGoI1YadUTsk20nnjN3Yf9e2zn3EdytlRbMNrsLcxsTto2Z4= Received: from AM5PR0801MB1732.eurprd08.prod.outlook.com (10.169.244.21) by AM5PR0801MB1906.eurprd08.prod.outlook.com (10.168.156.148) 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 11:48:25 +0000 Received: from AM5PR0801MB1732.eurprd08.prod.outlook.com ([fe80::50d7:cef5:ee39:2e83]) by AM5PR0801MB1732.eurprd08.prod.outlook.com ([fe80::50d7:cef5:ee39:2e83%9]) with mapi id 15.20.2178.020; Fri, 23 Aug 2019 11:48:25 +0000 From: "Alexei Fedorov" To: Sami Mujawar , "devel@edk2.groups.io" Subject: Re: [PATCH v1 19/19] MdePkg: Initialise VA_LIST variables before use Thread-Topic: [PATCH v1 19/19] MdePkg: Initialise VA_LIST variables before use Thread-Index: AQHVWaG37rCfta5DQU6m+Gl1q5rpAKcInfhK Date: Fri, 23 Aug 2019 11:48:25 +0000 Message-ID: References: <20190823105539.13260-1-sami.mujawar@arm.com>,<20190823105539.13260-20-sami.mujawar@arm.com> In-Reply-To: <20190823105539.13260-20-sami.mujawar@arm.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Alexei.Fedorov@arm.com; x-originating-ip: [217.140.106.49] x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: fbbc5306-f8fa-4234-8133-08d727bfd248 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam-Untrusted: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:AM5PR0801MB1906; X-MS-TrafficTypeDiagnostic: AM5PR0801MB1906:|VE1PR08MB4959: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:230;OLM:230; x-forefront-prvs: 0138CD935C X-Forefront-Antispam-Report-Untrusted: SFV:NSPM;SFS:(10009020)(4636009)(346002)(396003)(136003)(376002)(39860400002)(366004)(189003)(199004)(76176011)(19627405001)(26005)(2501003)(9686003)(66066001)(186003)(3846002)(102836004)(25786009)(105004)(6116002)(2906002)(55016002)(99286004)(66946007)(476003)(14444005)(53546011)(7696005)(446003)(76116006)(66446008)(478600001)(256004)(11346002)(66476007)(66556008)(64756008)(8936002)(8676002)(53936002)(52536014)(229853002)(486006)(33656002)(6506007)(81166006)(74316002)(6246003)(316002)(7736002)(71190400001)(71200400001)(54896002)(5660300002)(81156014)(86362001)(110136005)(14454004)(6436002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM5PR0801MB1906;H:AM5PR0801MB1732.eurprd08.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info-Original: X6Oi4uY4EnLefvmaoXcUiTWQ3P6bjeVmFknfO5QphikyQdyrMjTlEKEYR3q0kLaF4OAOW58DyUac0XEKhJNcRyRhVKUZDFCzxt5RYKSHCE4aMRhG2GlWZmKaJeodNVqNgj0T1o6DlPzGZk3gADuzfut/JHfSuQP5lTgXNP/0QKXnwMC9zVWavjv9DAxiD3Fe+dqpIq1qMVLu5nuqyM8ybVtgfZ6CoOkxm1LVqUwfjWKfyjQ2jRgoM7cp8npYoSC/GqtCq1O2XWiMD12bgKGixL8LSb3ytSkNgVIBmp/6RmrmUghajsYhnD0OUcoeakOKBdyBncAMdnmxGvUfaptszo0FS+dNanLXTtQMAkuoa6OBnJDdqpcMQSyPwvXq+m5+W7LrVrcKKztKcM/qED1bzEJqX5BcqF5Mw2qV2aPmkeE= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1906 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Alexei.Fedorov@arm.com; Return-Path: Alexei.Fedorov@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT035.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)(396003)(376002)(39860400002)(346002)(136003)(2980300002)(199004)(189003)(40434004)(30864003)(6116002)(76176011)(54896002)(7696005)(55016002)(26826003)(102836004)(19627405001)(71190400001)(9686003)(2501003)(6506007)(14454004)(66066001)(356004)(53546011)(229853002)(33656002)(478600001)(486006)(476003)(11346002)(446003)(126002)(52536014)(25786009)(14444005)(5024004)(8676002)(86362001)(105004)(22756006)(63370400001)(336012)(5660300002)(6246003)(16586007)(63350400001)(316002)(8936002)(36906005)(74316002)(70206006)(2906002)(70586007)(110136005)(76130400001)(81166006)(81156014)(3846002)(7736002)(99286004)(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: abf083f1-e6e1-4d2c-667c-08d727bfce62 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(710020)(711020)(4605104)(1401327)(2017052603328)(7193020);SRVR:VE1PR08MB4959; X-Forefront-PRVS: 0138CD935C X-Microsoft-Antispam-Message-Info: gY3NFonjG85Fm60/fFRMUg4Z3RGogPBJJZXDeCKae0D3VTnBB2DY9YA+9zF0Rl56dPTWEUTL8e3XtZi1y1dlag+LjQhbDmUgUNx+BjwzO7Dd09oGuxwumRA3ngZmisYpuAO23SauWN61XWsO+VPZ04BSMfn1Gl6EZ5aDttta5XpPowHwONQSuII8rBQgckIGATR0XomZbMPi8DxKwfsBAylvjHUVp/gvKVxHUT7WbG7fTBXVKwxnC/I/rKKcNAzMS5NUr/MRiZZbV/LnLT9ieX+bdMrm9QXMh7R7dycy3tPMAqljkiSSENyb00OjVKzbsy0vZpqDFZ/mWMGnZQ51Y+cevGcF3dc5t1ML/GobHrfotMFb6cDDt4vWkB0V6pvx2Ss4M2MytVBEI5eWdSzi3dKszEvadNFgaJXp5bdv9Ho= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2019 11:48:31.5437 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fbbc5306-f8fa-4234-8133-08d727bfd248 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-Language: en-GB Content-Type: multipart/alternative; boundary="_000_AM5PR0801MB1732A95612012F93C3D03EF49AA40AM5PR0801MB1732_" --_000_AM5PR0801MB1732A95612012F93C3D03EF49AA40AM5PR0801MB1732_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Alexei Fedorov Alexei ________________________________ From: Sami Mujawar Sent: 23 August 2019 11:55 To: devel@edk2.groups.io Cc: Sami Mujawar ; Alexei Fedorov ; ard.biesheuvel@linaro.org ; leif.lindholm= @linaro.org ; Matteo Carlini ; michael.d.kinney@intel.com ; liming.gao@i= ntel.com ; nd Subject: [PATCH v1 19/19] MdePkg: Initialise VA_LIST variables before use The VS2017 compiler reports 'warning C6001: Using uninitialized memory 'Marker'.' for VA_LIST variables. To fix this issue declare a VA_LIST global variable and use this to initialise VA_LIST variables before use. Note: The VA_LIST cannot be assigned a NULL value because some compilers define VA_LIST to be a structure. Signed-off-by: Sami Mujawar --- MdePkg/Library/BaseLib/SwitchStack.c | 9 +++++++++ MdePkg/Library/BasePrintLib/PrintLib.c | 5 +++++ MdePkg/Library/BasePrintLib/PrintLibInternal.c | 9 +++++++++ 3 files changed, 23 insertions(+) diff --git a/MdePkg/Library/BaseLib/SwitchStack.c b/MdePkg/Library/BaseLib/= SwitchStack.c index cb9f69f1eaceba690b48e9ca6b8a9af2e348bddd..e1bb524819b3de3521c5461ce68= 1aa3a6c186f2c 100644 --- a/MdePkg/Library/BaseLib/SwitchStack.c +++ b/MdePkg/Library/BaseLib/SwitchStack.c @@ -2,12 +2,20 @@ Switch Stack functions. Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2019, ARM Ltd. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ #include "BaseLibInternals.h" +// +// Declare a VA_LIST global variable that is used to initialise VA_LIST +// variables before use. The VA_LIST cannot be assigned a NULL value +// because some compilers define VA_LIST to be a structure. +// +STATIC VA_LIST gNullVaList; + /** Transfers control to a function starting with a new stack. @@ -57,6 +65,7 @@ SwitchStack ( // ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) =3D=3D 0); + Marker =3D gNullVaList; VA_START (Marker, NewStack); InternalSwitchStack (EntryPoint, Context1, Context2, NewStack, Marker); diff --git a/MdePkg/Library/BasePrintLib/PrintLib.c b/MdePkg/Library/BasePr= intLib/PrintLib.c index af771652e4b0aebd616973ba1089ae5bc2b6f0c0..67c5f3dd547cea5447075ef88d6= 97879883ba5ab 100644 --- a/MdePkg/Library/BasePrintLib/PrintLib.c +++ b/MdePkg/Library/BasePrintLib/PrintLib.c @@ -3,6 +3,7 @@ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
+ Copyright (c) 2019, ARM Ltd. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -177,6 +178,7 @@ UnicodeSPrint ( VA_LIST Marker; UINTN NumberOfPrinted; + Marker =3D gNullVaList; VA_START (Marker, FormatString); NumberOfPrinted =3D UnicodeVSPrint (StartOfBuffer, BufferSize, FormatStr= ing, Marker); VA_END (Marker); @@ -337,6 +339,7 @@ UnicodeSPrintAsciiFormat ( VA_LIST Marker; UINTN NumberOfPrinted; + Marker =3D gNullVaList; VA_START (Marker, FormatString); NumberOfPrinted =3D UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize= , FormatString, Marker); VA_END (Marker); @@ -614,6 +617,7 @@ AsciiSPrint ( VA_LIST Marker; UINTN NumberOfPrinted; + Marker =3D gNullVaList; VA_START (Marker, FormatString); NumberOfPrinted =3D AsciiVSPrint (StartOfBuffer, BufferSize, FormatStrin= g, Marker); VA_END (Marker); @@ -774,6 +778,7 @@ AsciiSPrintUnicodeFormat ( VA_LIST Marker; UINTN NumberOfPrinted; + Marker =3D gNullVaList; VA_START (Marker, FormatString); NumberOfPrinted =3D AsciiVSPrintUnicodeFormat (StartOfBuffer, BufferSize= , FormatString, Marker); VA_END (Marker); diff --git a/MdePkg/Library/BasePrintLib/PrintLibInternal.c b/MdePkg/Librar= y/BasePrintLib/PrintLibInternal.c index b6ec5ac4fbb98982f8ccaf3908c2a91ce583e31e..11392f2a5d12eb059611c3ff77b= 27b602f9b9a40 100644 --- a/MdePkg/Library/BasePrintLib/PrintLibInternal.c +++ b/MdePkg/Library/BasePrintLib/PrintLibInternal.c @@ -2,12 +2,20 @@ Print Library internal worker functions. Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2019, ARM Ltd. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ #include "PrintLibInternal.h" +// +// Declare a VA_LIST global variable that is used to initialise VA_LIST +// variables before use. The VA_LIST cannot be assigned a NULL value +// because some compilers define VA_LIST to be a structure. +// +extern VA_LIST gNullVaList; + #define WARNING_STATUS_NUMBER 5 #define ERROR_STATUS_NUMBER 33 @@ -1256,6 +1264,7 @@ BasePrintLibSPrint ( VA_LIST Marker; UINTN NumberOfPrinted; + Marker =3D gNullVaList; VA_START (Marker, FormatString); NumberOfPrinted =3D BasePrintLibSPrintMarker (StartOfBuffer, BufferSize,= Flags, FormatString, Marker, NULL); VA_END (Marker); -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you. --_000_AM5PR0801MB1732A95612012F93C3D03EF49AA40AM5PR0801MB1732_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>

Alexei


From: Sami Mujawar <sami= .mujawar@arm.com>
Sent: 23 August 2019 11:55
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Sami Mujawar <Sami.Mujawar@arm.com>; Alexei Fedorov <Al= exei.Fedorov@arm.com>; ard.biesheuvel@linaro.org <ard.biesheuvel@lina= ro.org>; leif.lindholm@linaro.org <leif.lindholm@linaro.org>; Matt= eo Carlini <Matteo.Carlini@arm.com>; michael.d.kinney@intel.com <michael.d.kinney@intel.com>; liming.gao@intel.com <liming.gao@in= tel.com>; nd <nd@arm.com>
Subject: [PATCH v1 19/19] MdePkg: Initialise VA_LIST variables befor= e use
 
The VS2017 compiler reports 'warning C6001: Using<= br> uninitialized memory 'Marker'.' for VA_LIST
variables.

To fix this issue declare a VA_LIST global variable
and use this to initialise VA_LIST variables before
use.

Note: The VA_LIST cannot be assigned a NULL value
because some compilers define VA_LIST to be a
structure.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
 MdePkg/Library/BaseLib/SwitchStack.c     &nb= sp;     | 9 ++++++++= 3;
 MdePkg/Library/BasePrintLib/PrintLib.c     &= nbsp;   | 5 +++++
 MdePkg/Library/BasePrintLib/PrintLibInternal.c | 9 +++= 3;+++++
 3 files changed, 23 insertions(+)

diff --git a/MdePkg/Library/BaseLib/SwitchStack.c b/MdePkg/Library/BaseLib/= SwitchStack.c
index cb9f69f1eaceba690b48e9ca6b8a9af2e348bddd..e1bb524819b3de3521c5461ce68= 1aa3a6c186f2c 100644
--- a/MdePkg/Library/BaseLib/SwitchStack.c
+++ b/MdePkg/Library/BaseLib/SwitchStack.c
@@ -2,12 +2,20 @@
   Switch Stack functions.
 
   Copyright (c) 2006 - 2018, Intel Corporation. All rights reser= ved.<BR>
+  Copyright (c) 2019, ARM Ltd. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
 #include "BaseLibInternals.h"
 
+//
+// Declare a VA_LIST global variable that is used to initialise VA_LIS= T
+// variables before use. The VA_LIST cannot be assigned a NULL value +// because some compilers define VA_LIST to be a structure.
+//
+STATIC VA_LIST gNullVaList;
+
 /**
   Transfers control to a function starting with a new stack.
 
@@ -57,6 +65,7 @@ SwitchStack (
   //
   ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) =3D= =3D 0);
 
+  Marker =3D gNullVaList;
   VA_START (Marker, NewStack);
 
   InternalSwitchStack (EntryPoint, Context1, Context2, NewStack,= Marker);
diff --git a/MdePkg/Library/BasePrintLib/PrintLib.c b/MdePkg/Library/BasePr= intLib/PrintLib.c
index af771652e4b0aebd616973ba1089ae5bc2b6f0c0..67c5f3dd547cea5447075ef88d6= 97879883ba5ab 100644
--- a/MdePkg/Library/BasePrintLib/PrintLib.c
+++ b/MdePkg/Library/BasePrintLib/PrintLib.c
@@ -3,6 +3,7 @@
 
   Copyright (c) 2006 - 2018, Intel Corporation. All rights reser= ved.<BR>
   Portions copyright (c) 2008 - 2009, Apple Inc. All rights rese= rved.<BR>
+  Copyright (c) 2019, ARM Ltd. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -177,6 +178,7 @@ UnicodeSPrint (
   VA_LIST Marker;
   UINTN   NumberOfPrinted;
 
+  Marker =3D gNullVaList;
   VA_START (Marker, FormatString);
   NumberOfPrinted =3D UnicodeVSPrint (StartOfBuffer, BufferSize,= FormatString, Marker);
   VA_END (Marker);
@@ -337,6 +339,7 @@ UnicodeSPrintAsciiFormat (
   VA_LIST Marker;
   UINTN   NumberOfPrinted;
 
+  Marker =3D gNullVaList;
   VA_START (Marker, FormatString);
   NumberOfPrinted =3D UnicodeVSPrintAsciiFormat (StartOfBuffer, = BufferSize, FormatString, Marker);
   VA_END (Marker);
@@ -614,6 +617,7 @@ AsciiSPrint (
   VA_LIST Marker;
   UINTN   NumberOfPrinted;
 
+  Marker =3D gNullVaList;
   VA_START (Marker, FormatString);
   NumberOfPrinted =3D AsciiVSPrint (StartOfBuffer, BufferSize, F= ormatString, Marker);
   VA_END (Marker);
@@ -774,6 +778,7 @@ AsciiSPrintUnicodeFormat (
   VA_LIST Marker;
   UINTN   NumberOfPrinted;
 
+  Marker =3D gNullVaList;
   VA_START (Marker, FormatString);
   NumberOfPrinted =3D AsciiVSPrintUnicodeFormat (StartOfBuffer, = BufferSize, FormatString, Marker);
   VA_END (Marker);
diff --git a/MdePkg/Library/BasePrintLib/PrintLibInternal.c b/MdePkg/Librar= y/BasePrintLib/PrintLibInternal.c
index b6ec5ac4fbb98982f8ccaf3908c2a91ce583e31e..11392f2a5d12eb059611c3ff77b= 27b602f9b9a40 100644
--- a/MdePkg/Library/BasePrintLib/PrintLibInternal.c
+++ b/MdePkg/Library/BasePrintLib/PrintLibInternal.c
@@ -2,12 +2,20 @@
   Print Library internal worker functions.
 
   Copyright (c) 2006 - 2018, Intel Corporation. All rights reser= ved.<BR>
+  Copyright (c) 2019, ARM Ltd. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
 #include "PrintLibInternal.h"
 
+//
+// Declare a VA_LIST global variable that is used to initialise VA_LIS= T
+// variables before use. The VA_LIST cannot be assigned a NULL value +// because some compilers define VA_LIST to be a structure.
+//
+extern VA_LIST gNullVaList;
+
 #define WARNING_STATUS_NUMBER      &nbs= p;  5
 #define ERROR_STATUS_NUMBER       =     33
 
@@ -1256,6 +1264,7 @@ BasePrintLibSPrint (
   VA_LIST  Marker;
   UINTN    NumberOfPrinted;
 
+  Marker =3D gNullVaList;
   VA_START (Marker, FormatString);
   NumberOfPrinted =3D BasePrintLibSPrintMarker (StartOfBuffer, B= ufferSize, Flags, FormatString, Marker, NULL);
   VA_END (Marker);
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in any medium. Thank you. --_000_AM5PR0801MB1732A95612012F93C3D03EF49AA40AM5PR0801MB1732_--