libvirtio: Mark struct virtio_scsi_req_cmd as packed

Message ID 1509652882-7144-1-git-send-email-thuth@redhat.com
State New
Headers show
Series
  • libvirtio: Mark struct virtio_scsi_req_cmd as packed
Related show

Commit Message

Thomas Huth Nov. 2, 2017, 8:01 p.m.
The struct contains an uneven amount of bytes, so we should use
the "packed" attribute to avoid padding problems here. So far the
problems did not show up yet since the struct is filled by Forth
code only and QEMU seems to be quite forgiving about the length of
the descriptor, but anyway, let's better be safe than sorry here.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 lib/libvirtio/virtio-scsi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/lib/libvirtio/virtio-scsi.h b/lib/libvirtio/virtio-scsi.h
index 451ba4d..d598dea 100644
--- a/lib/libvirtio/virtio-scsi.h
+++ b/lib/libvirtio/virtio-scsi.h
@@ -47,7 +47,7 @@  struct virtio_scsi_req_cmd {
     uint8_t prio;
     uint8_t crn;
     char cdb[VIRTIO_SCSI_CDB_SIZE];
-};
+} __attribute__((packed));
 
 /* This is the first element of the "in" scatter-gather list. */
 struct virtio_scsi_resp_cmd {