[PATCH kvm-unit-tests v2 1/8] virtio-mmio: fix queue allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ensure we clear the queue memory we get from alloc_pages().
Otherwise QEMU gets angry when we attempt to migrate a unit
test as the used vring index is corrupted by the page
allocator's next page link.

Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx>
---
 lib/virtio-mmio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/virtio-mmio.c b/lib/virtio-mmio.c
index e5e8f660b5cd..57fe78ecbb6c 100644
--- a/lib/virtio-mmio.c
+++ b/lib/virtio-mmio.c
@@ -56,6 +56,7 @@ static struct virtqueue *vm_setup_vq(struct virtio_device *vdev,
 	vq = calloc(1, sizeof(*vq));
 	assert(VIRTIO_MMIO_QUEUE_SIZE_MIN <= 2*PAGE_SIZE);
 	queue = alloc_pages(1);
+	memset(queue, 0, 2*PAGE_SIZE);
 	assert(vq && queue);
 
 	writel(index, vm_dev->base + VIRTIO_MMIO_QUEUE_SEL);
-- 
2.13.6




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux