summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/VirtioScsiDxe
diff options
context:
space:
mode:
authorDandan Bi <dandan.bi@intel.com>2018-03-23 11:21:56 +0800
committerLiming Gao <liming.gao@intel.com>2018-03-28 09:58:49 +0800
commit699a2c30cb6e74a55f0c3f67c376460f99c201ed (patch)
tree039d4be3c443f3cd721f2b39d8c5d5f9bfe43d30 /OvmfPkg/VirtioScsiDxe
parentd1b777440bc616f1e6da9204f3eec9f7a5a6f2e2 (diff)
downloadedk2-699a2c30cb6e74a55f0c3f67c376460f99c201ed.tar.gz
edk2-699a2c30cb6e74a55f0c3f67c376460f99c201ed.tar.bz2
edk2-699a2c30cb6e74a55f0c3f67c376460f99c201ed.zip
OvmfPkg:Fix VS2012 build failure
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" on input, *and* we map the input buffer successfully. The similar reason for "OutDataMapping" and "OutDataDeviceAddress". Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'OvmfPkg/VirtioScsiDxe')
-rw-r--r--OvmfPkg/VirtioScsiDxe/VirtioScsi.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
index 1a68f06210..e773ecf7cc 100644
--- a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
+++ b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
@@ -26,7 +26,7 @@
unreasonable for now.
Copyright (C) 2012, Red Hat, Inc.
- Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2017, AMD Inc, All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
@@ -455,6 +455,15 @@ VirtioScsiPassThru (
UINTN InDataNumPages;
BOOLEAN OutDataBufferIsMapped;
+ //
+ // Set InDataMapping,OutDataMapping,InDataDeviceAddress and OutDataDeviceAddress to
+ // suppress incorrect compiler/analyzer warnings.
+ //
+ InDataMapping = NULL;
+ OutDataMapping = NULL;
+ InDataDeviceAddress = 0;
+ OutDataDeviceAddress = 0;
+
ZeroMem ((VOID*) &Request, sizeof (Request));
Dev = VIRTIO_SCSI_FROM_PASS_THRU (This);