virtio: allow mapping up to max queue size
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>
This commit is contained in:
parent
06b4f00d53
commit
9372514080
|
@ -430,7 +430,7 @@ void virtqueue_map_sg(struct iovec *sg, hwaddr *addr,
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
hwaddr len;
|
hwaddr len;
|
||||||
|
|
||||||
if (num_sg >= VIRTQUEUE_MAX_SIZE) {
|
if (num_sg > VIRTQUEUE_MAX_SIZE) {
|
||||||
error_report("virtio: map attempt out of bounds: %zd > %d",
|
error_report("virtio: map attempt out of bounds: %zd > %d",
|
||||||
num_sg, VIRTQUEUE_MAX_SIZE);
|
num_sg, VIRTQUEUE_MAX_SIZE);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
Loading…
Reference in a new issue