]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
virtio: allow mapping up to max queue size
authorMichael S. Tsirkin <mst@redhat.com>
Mon, 12 May 2014 09:04:20 +0000 (12:04 +0300)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 1 Jul 2014 16:03:24 +0000 (11:03 -0500)
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" <dgilbert@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 937251408051e0489f78e4db3c92e045b147b38b)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/virtio/virtio.c

index 151fae9b3dd2a1bf9a1dc4bfda9aaf633f301811..c6265c69fed112a33d7db8577f6996299a144360 100644 (file)
@@ -427,7 +427,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);