|
From: | Paolo Bonzini |
Subject: | Re: [Qemu-devel] [PATCH 05/15] scsi: pass residual amount to command_complete |
Date: | Fri, 10 Feb 2012 12:58:21 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20120131 Thunderbird/10.0 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |