]> xenbits.xensource.com Git - qemu-upstream-4.3-testing.git/commitdiff
virtio: don't mark unaccessed memory as dirty
authorMichael S. Tsirkin <mst@redhat.com>
Mon, 24 Sep 2012 13:09:30 +0000 (15:09 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 28 Sep 2012 10:16:27 +0000 (12:16 +0200)
offset of accessed buffer is calculated using iov_length, so it
can exceed accessed len. If that happens
math in len - offset wraps around, and size becomes wrong.
As real value is 0, so this is harmless but unnecessary.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio.c

index 209c763751bd0f9686f78357d19a866feb221b24..b5764bb8f71d6f96d2df01a84db46d33e1f096b2 100644 (file)
@@ -241,7 +241,7 @@ void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
                                   elem->in_sg[i].iov_len,
                                   1, size);
 
-        offset += elem->in_sg[i].iov_len;
+        offset += size;
     }
 
     for (i = 0; i < elem->out_num; i++)