mirror of https://github.com/acidanthera/audk.git
OvmfPkg VirtioScsiDxe: Fix build with VS2010
Structures should not be directly assigned in EDK II code, since this leads to different behaviours on various compilers. Instead, use ZeroMem to zero out the structures. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13878 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
5077d4e5df
commit
151304d96d
|
@ -413,19 +413,8 @@ VirtioScsiPassThru (
|
|||
volatile VIRTIO_SCSI_RESP Response;
|
||||
DESC_INDICES Indices;
|
||||
|
||||
//
|
||||
// Zero-initialization of Request & Response with "= { 0 };" doesn't build
|
||||
// with gcc-4.4: "undefined reference to `memset'". Direct SetMem() is not
|
||||
// allowed as it would cast away the volatile qualifier. Work it around.
|
||||
//
|
||||
union {
|
||||
VIRTIO_SCSI_REQ Request;
|
||||
VIRTIO_SCSI_RESP Response;
|
||||
} Zero;
|
||||
|
||||
SetMem (&Zero, sizeof Zero, 0x00);
|
||||
Request = Zero.Request;
|
||||
Response = Zero.Response;
|
||||
ZeroMem ((VOID*) &Request, sizeof (Request));
|
||||
ZeroMem ((VOID*) &Response, sizeof (Response));
|
||||
|
||||
Dev = VIRTIO_SCSI_FROM_PASS_THRU (This);
|
||||
CopyMem (&TargetValue, Target, sizeof TargetValue);
|
||||
|
|
Loading…
Reference in New Issue