]> git.ipfire.org Git - thirdparty/qemu.git/commit
virtio: fix vq->inuse recalc after migr
authorHalil Pasic <pasic@linux.vnet.ibm.com>
Mon, 19 Dec 2016 15:44:44 +0000 (16:44 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 16 Mar 2017 17:10:38 +0000 (12:10 -0500)
commit7830be742a55fc83bc9b74125452e5212ed99da6
tree6619dd60936c068057f3d0a026412eb9112de7cc
parent620a65dc44e120b4b3530dfd546434f494c81a44
virtio: fix vq->inuse recalc after migr

Correct recalculation of vq->inuse after migration for the corner case
where the avail_idx has already wrapped but used_idx not yet.

Also change the type of the VirtQueue.inuse to unsigned int. This is
done to be consistent with other members representing sizes (VRing.num),
and because C99 guarantees max ring size < UINT_MAX but does not
guarantee max ring size < INT_MAX.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Fixes: bccdef6b ("virtio: recalculate vq->inuse after migration")
CC: qemu-stable@nongnu.org
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit e66bcc408146730958d1a840bda85d7ad51e0cd7)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/virtio/virtio.c