From 6e925bbb1a0389535263f69b8a8645dcf3ae926e Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Thu, 2 Nov 2017 21:01:22 +0100 Subject: libvirtio: Mark struct virtio_scsi_req_cmd as packed 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 Reviewed-by: Nikunj A Dadhania Signed-off-by: Alexey Kardashevskiy --- lib/libvirtio/virtio-scsi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') 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 { -- cgit v1.1