@samitouri / QOSamiQemu / commits / f4193228dd

scsi: change buf_size to unsigned int in scsi_SG_IO()

SG_IO supports an unsigned int dxfer_len value. Existing callers use less than 256 bytes, so scsi_SG_IO()'s uint8_t buf_size type was sufficient. The next patch will use a larger value, so update the type. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Link: https://lore.kernel.org/r/20260415232906.212349-2-stefanha@redhat.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Stefan Hajnoczi committed Apr 15, 2026 at 19:29 UTC f4193228dd20d3d5b8eaaf65f46e2426181794f3
2 files changed +3 -2
hw/scsi/scsi-generic.c
+1 -1
@@ -774,7 +774,7 @@ static int read_naa_id(const uint8_t *p, uint64_t *p_wwn)
774 }
775
776 int scsi_SG_IO(BlockBackend *blk, int direction, uint8_t *cmd,
777 - uint8_t cmd_size, uint8_t *buf, uint8_t buf_size,
777 + uint8_t cmd_size, uint8_t *buf, unsigned int buf_size,
778 uint32_t timeout, Error **errp)
779 {
780 sg_io_hdr_t io_header;
include/hw/scsi/scsi.h
+2 -1
@@ -247,7 +247,8 @@ void scsi_device_unit_attention_reported(SCSIDevice *dev);
247 void scsi_generic_read_device_inquiry(SCSIDevice *dev);
248 int scsi_device_get_sense(SCSIDevice *dev, uint8_t *buf, int len, bool fixed);
249 int scsi_SG_IO(BlockBackend *blk, int direction, uint8_t *cmd, uint8_t cmd_size,
250 - uint8_t *buf, uint8_t buf_size, uint32_t timeout, Error **errp);
250 + uint8_t *buf, unsigned int buf_size, uint32_t timeout,
251 + Error **errp);
252 SCSIDevice *scsi_device_find(SCSIBus *bus, int channel, int target, int lun);
253 SCSIDevice *scsi_device_get(SCSIBus *bus, int channel, int target, int lun);
254