]> Git Repo - qemu.git/commit
virtio-scsi: Fix build with gcc 9
authorGreg Kurz <[email protected]>
Thu, 28 Feb 2019 17:59:42 +0000 (18:59 +0100)
committerPaolo Bonzini <[email protected]>
Mon, 11 Mar 2019 15:33:49 +0000 (16:33 +0100)
commitd804232dc4a5400494442b04e0a066711f4f5b44
tree8b0e85df91575a785169d80f65a93a6ebc20ec1e
parentf24c3a79a415042f6dc195f029a2ba7247d14cac
virtio-scsi: Fix build with gcc 9

Build fails with gcc 9:

  CC      ppc64-softmmu/hw/scsi/virtio-scsi.o
hw/scsi/virtio-scsi.c: In function â€˜virtio_scsi_do_tmf’:
hw/scsi/virtio-scsi.c:265:39: error: taking address of packed member of â€˜struct virtio_scsi_ctrl_tmf_req’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
  265 |     virtio_tswap32s(VIRTIO_DEVICE(s), &req->req.tmf.subtype);
      |                                       ^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

All the fields in struct virtio_scsi_ctrl_tmf_req are naturally aligned,
so we could in theory drop QEMU_PACKED. Unfortunately, the header file
is imported from linux which already has the packed attribute. Trying to
fix that in the update-linux-headers.sh script is likely to produce
ugliness. Turn the call to virtio_tswap32s() into an assignment instead.

Signed-off-by: Greg Kurz <[email protected]>
Message-Id: <155137678223.44753.5438092367451176318[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
hw/scsi/virtio-scsi.c
This page took 0.02584 seconds and 4 git commands to generate.