]> git.proxmox.com Git - qemu.git/commitdiff
virtio: virtqueue_get_avail_bytes: fix desc_pa when loop over the indirect descriptor...
authoryinyin <yin.yin@cs2c.com.cn>
Thu, 22 Aug 2013 06:47:16 +0000 (14:47 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Sun, 25 Aug 2013 09:52:33 +0000 (12:52 +0300)
virtqueue_get_avail_bytes: when found a indirect desc, we need loop over it.
           /* loop over the indirect descriptor table */
           indirect = 1;
           max = vring_desc_len(desc_pa, i) / sizeof(VRingDesc);
           num_bufs = i = 0;
           desc_pa = vring_desc_addr(desc_pa, i);
But, It init i to 0, then use i to update desc_pa. so we will always get:
desc_pa = vring_desc_addr(desc_pa, 0);
the last two line should swap.

Cc: qemu-stable@nongnu.org
Signed-off-by: Yin Yin <yin.yin@cs2c.com.cn>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio/virtio.c

index f03c45dff56f6ca3a71d5e71f361309ec2297329..2f1e73bc750cab541c7c94b16a1d7025d40c8737 100644 (file)
@@ -377,8 +377,8 @@ void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned int *in_bytes,
             /* loop over the indirect descriptor table */
             indirect = 1;
             max = vring_desc_len(desc_pa, i) / sizeof(VRingDesc);
-            num_bufs = i = 0;
             desc_pa = vring_desc_addr(desc_pa, i);
+            num_bufs = i = 0;
         }
 
         do {