[SLOF] [PATCH] libvirtio: Mark struct virtio_scsi_req_cmd as packed

Thomas Huth thuth at redhat.com
Wed Dec 6 19:08:48 AEDT 2017


On 02.11.2017 21:01, Thomas Huth wrote:
> 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>
> ---
>  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 {
> 

Ping?


More information about the SLOF mailing list