mirror of https://github.com/acidanthera/audk.git
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>
This commit is contained in:
parent
d1b777440b
commit
699a2c30cb
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
Virtual Memory Management Services to set or clear the memory encryption bit
|
Virtual Memory Management Services to set or clear the memory encryption bit
|
||||||
|
|
||||||
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
|
Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
|
@ -596,6 +596,11 @@ SetMemoryEncDec (
|
||||||
BOOLEAN IsWpEnabled;
|
BOOLEAN IsWpEnabled;
|
||||||
RETURN_STATUS Status;
|
RETURN_STATUS Status;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Set PageMapLevel4Entry to suppress incorrect compiler/analyzer warnings.
|
||||||
|
//
|
||||||
|
PageMapLevel4Entry = NULL;
|
||||||
|
|
||||||
DEBUG ((
|
DEBUG ((
|
||||||
DEBUG_VERBOSE,
|
DEBUG_VERBOSE,
|
||||||
"%a:%a: Cr3Base=0x%Lx Physical=0x%Lx Length=0x%Lx Mode=%a CacheFlush=%u\n",
|
"%a:%a: Cr3Base=0x%Lx Physical=0x%Lx Length=0x%Lx Mode=%a CacheFlush=%u\n",
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
synchronous requests and EFI_BLOCK_IO_PROTOCOL for now.
|
synchronous requests and EFI_BLOCK_IO_PROTOCOL for now.
|
||||||
|
|
||||||
Copyright (C) 2012, Red Hat, Inc.
|
Copyright (C) 2012, Red Hat, Inc.
|
||||||
Copyright (c) 2012 - 2016, 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>
|
Copyright (c) 2017, AMD Inc, All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
|
@ -264,6 +264,13 @@ SynchronousRequest (
|
||||||
|
|
||||||
BlockSize = Dev->BlockIoMedia.BlockSize;
|
BlockSize = Dev->BlockIoMedia.BlockSize;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Set BufferMapping and BufferDeviceAddress to suppress incorrect
|
||||||
|
// compiler/analyzer warnings.
|
||||||
|
//
|
||||||
|
BufferMapping = NULL;
|
||||||
|
BufferDeviceAddress = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
// ensured by VirtioBlkInit()
|
// ensured by VirtioBlkInit()
|
||||||
//
|
//
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
unreasonable for now.
|
unreasonable for now.
|
||||||
|
|
||||||
Copyright (C) 2012, Red Hat, Inc.
|
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>
|
Copyright (c) 2017, AMD Inc, All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
|
@ -455,6 +455,15 @@ VirtioScsiPassThru (
|
||||||
UINTN InDataNumPages;
|
UINTN InDataNumPages;
|
||||||
BOOLEAN OutDataBufferIsMapped;
|
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));
|
ZeroMem ((VOID*) &Request, sizeof (Request));
|
||||||
|
|
||||||
Dev = VIRTIO_SCSI_FROM_PASS_THRU (This);
|
Dev = VIRTIO_SCSI_FROM_PASS_THRU (This);
|
||||||
|
|
Loading…
Reference in New Issue