yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
958e1b
From c518aac987c63baaf6f039589c043e3da966974e Mon Sep 17 00:00:00 2001
eb5a2f
From: Michael S. Tsirkin <mst@redhat.com>
958e1b
Date: Wed, 14 May 2014 08:34:08 +0200
958e1b
Subject: [PATCH 17/31] virtio: allow mapping up to max queue size
eb5a2f
eb5a2f
RH-Author: Michael S. Tsirkin <mst@redhat.com>
958e1b
Message-id: <1400056377-6802-2-git-send-email-mst@redhat.com>
958e1b
Patchwork-id: 58863
958e1b
O-Subject: [PATCH qemu-kvm RHEL7.1 2/2] virtio: allow mapping up to max queue size
958e1b
Bugzilla: 1095766
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
958e1b
(in maintainer's tree, pull request sent)
eb5a2f
Tested: lightly on developer's box
958e1b
Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7452039
958e1b
Bugzilla:1095766
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