eb5a2f
From 7a967f4dd36ab8cba940bacda4c893829affcd8d Mon Sep 17 00:00:00 2001
eb5a2f
From: Michael S. Tsirkin <mst@redhat.com>
eb5a2f
Date: Wed, 14 May 2014 08:11:59 +0200
eb5a2f
Subject: [PATCH 09/30] virtio: allow mapping up to max queue size
eb5a2f
eb5a2f
RH-Author: Michael S. Tsirkin <mst@redhat.com>
eb5a2f
Message-id: <1400054952-6106-2-git-send-email-mst@redhat.com>
eb5a2f
Patchwork-id: 58847
eb5a2f
O-Subject: [PATCH qemu-kvm RHEL7.0 2/2] virtio: allow mapping up to max queue size
eb5a2f
Bugzilla: 1095765
eb5a2f
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
eb5a2f
RH-Acked-by: Xiao Wang <jasowang@redhat.com>
eb5a2f
RH-Acked-by: Amos Kong <akong@redhat.com>
eb5a2f
eb5a2f
It's a loop from i < num_sg  and the array is VIRTQUEUE_MAX_SIZE - so
eb5a2f
it's OK if the value read is VIRTQUEUE_MAX_SIZE.
eb5a2f
eb5a2f
Not a big problem in practice as people don't use
eb5a2f
such big queues, but it's inelegant.
eb5a2f
eb5a2f
Reported-by: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
eb5a2f
Cc: qemu-stable@nongnu.org
eb5a2f
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
eb5a2f
eb5a2f
Upstream status: 937251408051e0489f78e4db3c92e045b147b38b
eb5a2f
(in maintainer's tree, PULL request sent)
eb5a2f
Tested: lightly on developer's box
eb5a2f
Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7450401
eb5a2f
Bugzilla:1095765
eb5a2f
---
eb5a2f
 hw/virtio/virtio.c | 2 +-
eb5a2f
 1 file changed, 1 insertion(+), 1 deletion(-)
eb5a2f
eb5a2f
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
eb5a2f
---
eb5a2f
 hw/virtio/virtio.c |    2 +-
eb5a2f
 1 files changed, 1 insertions(+), 1 deletions(-)
eb5a2f
eb5a2f
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
eb5a2f
index 2667390..44309c2 100644
eb5a2f
--- a/hw/virtio/virtio.c
eb5a2f
+++ b/hw/virtio/virtio.c
eb5a2f
@@ -423,7 +423,7 @@ void virtqueue_map_sg(struct iovec *sg, hwaddr *addr,
eb5a2f
     unsigned int i;
eb5a2f
     hwaddr len;
eb5a2f
 
eb5a2f
-    if (num_sg >= VIRTQUEUE_MAX_SIZE) {
eb5a2f
+    if (num_sg > VIRTQUEUE_MAX_SIZE) {
eb5a2f
         error_report("virtio: map attempt out of bounds: %zd > %d",
eb5a2f
                      num_sg, VIRTQUEUE_MAX_SIZE);
eb5a2f
         exit(1);
eb5a2f
-- 
eb5a2f
1.7.1
eb5a2f