From 151304d96d9abd61a71c9f90eb4a0d0c9f0fc391 Mon Sep 17 00:00:00 2001 From: jljusten Date: Tue, 23 Oct 2012 22:16:14 +0000 Subject: 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 Reviewed-by: Laszlo Ersek git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13878 6f19259b-4bc3-4df7-8a09-765794883524 --- OvmfPkg/VirtioScsiDxe/VirtioScsi.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c index 66f6d31d74..e58dd80df2 100644 --- a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c +++ b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c @@ -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); -- cgit v1.2.3