From fd11a78be8dfc992a5c642d8e2e1ebd80a761b86 Mon Sep 17 00:00:00 2001 From: Amit Shah Date: Thu, 1 Jul 2010 14:58:17 +0530 Subject: [PATCH] virtio-serial: Assert for virtio queue ready before virtqueue operations In addition to the previous fix for calling do_flush_queued_data() only when the virtqueue is ready, ensure do_flush_queued_data() gets a vq that's suitably initialised. Signed-off-by: Amit Shah Signed-off-by: Anthony Liguori --- hw/virtio-serial-bus.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c index 077c3183bc..8e611c03e0 100644 --- a/hw/virtio-serial-bus.c +++ b/hw/virtio-serial-bus.c @@ -117,6 +117,7 @@ static void do_flush_queued_data(VirtIOSerialPort *port, VirtQueue *vq, VirtQueueElement elem; assert(port || discard); + assert(virtio_queue_ready(vq)); while ((discard || !port->throttled) && virtqueue_pop(vq, &elem)) { uint8_t *buf;