On 02/10/2012 12:44 PM, Stefan Hajnoczi wrote:
> +static void esp_command_complete(SCSIRequest *req, uint32_t status,
> + int32_t resid)
Is there a reason to use a signed type for resid? (I expected
uint32_t to be safer and more natural.)
It's a mess; req->cmd.xfer is a size_t, but it should be an uint64_t
with tests that it doesn't overflow (for example if you ask to transfer
more than 2^55 logical blocks!).
scsi_req_enqueue returns an int32_t, so you cannot transfer more than
31-bits per command right now, but you're right that resid is computed
as size_t - int32_t and in principle could overflow the 32-bit value.
I plan to change all of this to 64-bit, but I'm not working too much on
SCSI because I'd rather not inflict even more virtio-scsi rebase pain on
myself.
Paolo