[SLOF] [PATCH] libvirtio: Mark struct virtio_scsi_req_cmd as packed
Nikunj A Dadhania
nikunj at linux.vnet.ibm.com
Wed Dec 6 19:42:33 AEDT 2017
Thomas Huth <thuth at redhat.com> writes:
> 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 at redhat.com>
Reviewed-by: Nikunj A Dadhania <nikunj at linux.vnet.ibm.com>
> ---
> lib/libvirtio/virtio-scsi.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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 {
> --
> 1.8.3.1
>
> _______________________________________________
> SLOF mailing list
> SLOF at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/slof
More information about the SLOF
mailing list