From c518aac987c63baaf6f039589c043e3da966974e Mon Sep 17 00:00:00 2001 From: Michael S. Tsirkin Date: Wed, 14 May 2014 08:34:08 +0200 Subject: [PATCH 17/31] virtio: allow mapping up to max queue size RH-Author: Michael S. Tsirkin Message-id: <1400056377-6802-2-git-send-email-mst@redhat.com> Patchwork-id: 58863 O-Subject: [PATCH qemu-kvm RHEL7.1 2/2] virtio: allow mapping up to max queue size Bugzilla: 1095766 RH-Acked-by: Dr. David Alan Gilbert (git) RH-Acked-by: Xiao Wang RH-Acked-by: Amos Kong 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 Upstream status: 937251408051e0489f78e4db3c92e045b147b38b (in maintainer's tree, pull request sent) Tested: lightly on developer's box Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7452039 Bugzilla:1095766 --- hw/virtio/virtio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Signed-off-by: Miroslav Rezanina --- hw/virtio/virtio.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 2667390..44309c2 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -423,7 +423,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); -- 1.7.1