hw/scsi/spapr_vscsi: Do not mix SRP IU size with DMA buffer size
commitff78b728f6c9d2c274dab20114bfe052322365a1
authorPhilippe Mathieu-Daudé <philmd@redhat.com>
Thu, 5 Mar 2020 12:12:51 +0000 (5 13:12 +0100)
committerDavid Gibson <david@gibson.dropbear.id.au>
Tue, 17 Mar 2020 04:08:50 +0000 (17 15:08 +1100)
tree4cb1c74428cc0ea33c80b1b5a8812c16b701b97e
parent81e705494f2915b7b6174bc5695d19ee4a083a85
hw/scsi/spapr_vscsi: Do not mix SRP IU size with DMA buffer size

The 'union srp_iu' is meant as a pointer to any SRP Information
Unit type, it is not related to the size of a VIO DMA buffer.

Use a plain buffer for the VIO DMA read/write calls.
We can remove the reserved buffer from the 'union srp_iu'.

This issue was noticed when replacing the zero-length arrays
from hw/scsi/srp.h with flexible array member,
'clang -fsanitize=undefined' reported:

  hw/scsi/spapr_vscsi.c:69:29: error: field 'iu' with variable sized type 'union viosrp_iu' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
       union viosrp_iu         iu;
                               ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200305121253.19078-6-philmd@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/scsi/spapr_vscsi.c
hw/scsi/viosrp.h