From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgtU4-0003XG-JX for qemu-devel@nongnu.org; Mon, 05 Sep 2016 08:58:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bgtU1-00079M-K3 for qemu-devel@nongnu.org; Mon, 05 Sep 2016 08:58:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52536) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgtU1-00079H-Ef for qemu-devel@nongnu.org; Mon, 05 Sep 2016 08:58:41 -0400 Date: Mon, 5 Sep 2016 18:28:34 +0530 (IST) From: P J P In-Reply-To: Message-ID: References: <1472884428-9975-1-git-send-email-ppandit@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Subject: Re: [Qemu-devel] [PATCH] scsi: pvscsi: request descriptor data_length to 32 bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Qemu Developers , Dmitry Fleytman , Li Qiang +-- On Mon, 5 Sep 2016, Paolo Bonzini wrote --+ | Without a public spec it's hard, but I guess 2048 is more than enough. === diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c index 4245c15..4823b9d 100644 --- a/hw/scsi/vmw_pvscsi.c +++ b/hw/scsi/vmw_pvscsi.c @@ -628,17 +628,16 @@ pvscsi_queue_pending_descriptor(PVSCSIState *s, SCSIDevice **d, static void pvscsi_convert_sglist(PVSCSIRequest *r) { - int chunk_size; + int chunk_size, n = 0; uint64_t data_length = r->req.dataLen; PVSCSISGState sg = r->sg; - while (data_length) { - while (!sg.resid) { + while (data_length && n < 2048) { + while (!sg.resid && n++ < 2048) { pvscsi_get_next_sg_elem(&sg); trace_pvscsi_convert_sglist(r->req.context, r->sg.dataAddr, r->sg.resid); } - assert(data_length > 0); - chunk_size = MIN((unsigned) data_length, sg.resid); + chunk_size = MIN(data_length, sg.resid); if (chunk_size) { qemu_sglist_add(&r->sgl, sg.dataAddr, chunk_size); } === Does this look okay? -- Prasad J Pandit / Red Hat Product Security Team 47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F