From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkEve-0001n7-1A for qemu-devel@nongnu.org; Tue, 13 May 2014 11:47:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WkEvY-0002xf-3g for qemu-devel@nongnu.org; Tue, 13 May 2014 11:47:41 -0400 Message-ID: <1399996067.29925.69.camel@localhost.localdomain> From: Marcel Apfelbaum Date: Tue, 13 May 2014 18:47:47 +0300 In-Reply-To: <1399995730-28956-2-git-send-email-mst@redhat.com> References: <1399995730-28956-1-git-send-email-mst@redhat.com> <1399995730-28956-2-git-send-email-mst@redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PULL] virtio: allow mapping up to max queue size Reply-To: marcel.a@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Peter Maydell , qemu-stable@nongnu.org, qemu-devel@nongnu.org, Anthony Liguori , "Dr. David Alan Gilbert" On Tue, 2014-05-13 at 18:42 +0300, Michael S. Tsirkin wrote: > It's a loop from i < num_sg and the array is VIRTQUEUE_MAX_SIZE - so > it's OK if the value read is VIRTQUEUE_MAX_SIZE. > > Not a big problem in practice as people don't use > such big queues, but it's inelegant. > > Reported-by: "Dr. David Alan Gilbert" > Cc: qemu-stable@nongnu.org > Signed-off-by: Michael S. Tsirkin > --- > hw/virtio/virtio.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c > index 7f4e7ec..3557c17 100644 > --- a/hw/virtio/virtio.c > +++ b/hw/virtio/virtio.c > @@ -430,7 +430,7 @@ void virtqueue_map_sg(struct iovec *sg, hwaddr *addr, > unsigned int i; > hwaddr len; > > - if (num_sg >= VIRTQUEUE_MAX_SIZE) { > + if (num_sg > VIRTQUEUE_MAX_SIZE) { > error_report("virtio: map attempt out of bounds: %zd > %d", > num_sg, VIRTQUEUE_MAX_SIZE); > exit(1); ACK Thanks, Marcel