From nobody Sun May 5 04:25:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1521781993772686.9737105533377; Thu, 22 Mar 2018 22:13:13 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9B91A22571B44; Thu, 22 Mar 2018 22:06:39 -0700 (PDT) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E90D42202E4AE for ; Thu, 22 Mar 2018 22:06:37 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Mar 2018 22:13:09 -0700 Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by orsmga001.jf.intel.com with ESMTP; 22 Mar 2018 22:13:08 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=dandan.bi@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,348,1517904000"; d="scan'208";a="41468137" From: Dandan Bi To: edk2-devel@lists.01.org Date: Fri, 23 Mar 2018 13:12:42 +0800 Message-Id: <20180323051242.42332-1-dandan.bi@intel.com> X-Mailer: git-send-email 2.14.3.windows.1 Subject: [edk2] [patch] OvmfPkg:Fix VS2012 build failure X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laszlo Ersek , Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Initialize local variable to suppress warning C4701/C4703: potentially uninitialized local variable/pointer variable. 1.In VirtualMemory.c: Read of "PageMapLevel4Entry" in SetMemoryEncDe() is only reached when "PageMapLevel4Entry" is got correctly. 2.In VirtioBlk.c: Reads (dereferences) of "BufferMapping" and "BufferDeviceAddress" in SynchronousRequest() are only reached if "BufferSize > 0" *and* we map the data buffer successfully. 3.In VirtioScsi.c: Reads (dereferences) of "InDataMapping" and "InDataDeviceAddress", in VirtioScsiPassThru() are only reached if "Packet->InTransferLength > 0", *and* we map the input buffer successfully. The similar reason for "OutDataMapping" and "OutDataDeviceAddress". Cc: Laszlo Ersek Cc: Ard Biesheuvel Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi Reviewed-by: Laszlo Ersek --- OvmfPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c | 7 ++++++- OvmfPkg/VirtioBlkDxe/VirtioBlk.c | 8 +++++++- OvmfPkg/VirtioScsiDxe/VirtioScsi.c | 10 +++++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c b/Ovm= fPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c index c1bfa35d7a..1f1225dd13 100644 --- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c +++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c @@ -1,10 +1,10 @@ /** @file =20 Virtual Memory Management Services to set or clear the memory encryption= bit =20 - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
Copyright (c) 2017, AMD Incorporated. All rights reserved.
=20 This program and the accompanying materials are licensed and made availa= ble under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -594,10 +594,15 @@ SetMemoryEncDec ( UINT64 PgTableMask; UINT64 AddressEncMask; BOOLEAN IsWpEnabled; RETURN_STATUS Status; =20 + // + // Set LocalVariable to suppress incorrect compiler/analyzer warnigns. + // + PageMapLevel4Entry =3D NULL; + DEBUG (( DEBUG_VERBOSE, "%a:%a: Cr3Base=3D0x%Lx Physical=3D0x%Lx Length=3D0x%Lx Mode=3D%a Cach= eFlush=3D%u\n", gEfiCallerBaseName, __FUNCTION__, diff --git a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c b/OvmfPkg/VirtioBlkDxe/Virtio= Blk.c index 5559884345..653715fb7b 100644 --- a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c +++ b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c @@ -9,11 +9,11 @@ - Although the non-blocking interfaces of EFI_BLOCK_IO2_PROTOCOL could b= e a good match for multiple in-flight virtio-blk requests, we stick to synchronous requests and EFI_BLOCK_IO_PROTOCOL for now. =20 Copyright (C) 2012, Red Hat, Inc. - Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.
Copyright (c) 2017, AMD Inc, All rights reserved.
=20 This program and the accompanying materials are licensed and made availa= ble under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -262,10 +262,16 @@ SynchronousRequest ( EFI_STATUS Status; EFI_STATUS UnmapStatus; =20 BlockSize =3D Dev->BlockIoMedia.BlockSize; =20 + // + // Set LocalVariable to suppress incorrect compiler/analyzer warnigns. + // + BufferMapping =3D NULL; + BufferDeviceAddress =3D 0; + // // ensured by VirtioBlkInit() // ASSERT (BlockSize > 0); ASSERT (BlockSize % 512 =3D=3D 0); diff --git a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c b/OvmfPkg/VirtioScsiDxe/Vir= tioScsi.c index 1a68f06210..81aa89e6d9 100644 --- a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c +++ b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c @@ -24,11 +24,11 @@ VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET could be a good match. That would however require client code for the control queue, which is deemed unreasonable for now. =20 Copyright (C) 2012, Red Hat, Inc. - Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.
+ Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.
Copyright (c) 2017, AMD Inc, All rights reserved.
=20 This program and the accompanying materials are licensed and made availa= ble under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -453,10 +453,18 @@ VirtioScsiPassThru ( EFI_PHYSICAL_ADDRESS OutDataDeviceAddress; VOID *InDataBuffer; UINTN InDataNumPages; BOOLEAN OutDataBufferIsMapped; =20 + // + // Set LocalVariable to suppress incorrect compiler/analyzer warnigns. + // + InDataMapping =3D NULL; + OutDataMapping =3D NULL; + InDataDeviceAddress =3D 0; + OutDataDeviceAddress =3D 0; + ZeroMem ((VOID*) &Request, sizeof (Request)); =20 Dev =3D VIRTIO_SCSI_FROM_PASS_THRU (This); CopyMem (&TargetValue, Target, sizeof TargetValue); =20 --=20 2.14.3.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel