From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:53102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rvp7Y-0003T7-LQ for qemu-devel@nongnu.org; Fri, 10 Feb 2012 06:58:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rvp7S-0003w0-91 for qemu-devel@nongnu.org; Fri, 10 Feb 2012 06:58:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57774) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rvp7S-0003vv-11 for qemu-devel@nongnu.org; Fri, 10 Feb 2012 06:58:26 -0500 Message-ID: <4F35065D.3010807@redhat.com> Date: Fri, 10 Feb 2012 12:58:21 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1326731457-9056-1-git-send-email-pbonzini@redhat.com> <1326731457-9056-6-git-send-email-pbonzini@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 05/15] scsi: pass residual amount to command_complete List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org 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