On 10/22/12 23:42, Jordan Justen wrote: > 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.jus...@intel.com> > --- > 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 66f6d31..e58dd80 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);
Reviewed-by: Laszlo Ersek <ler...@redhat.com> ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel