aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorYury Kotov <yury-kotov@yandex-team.ru>2018-07-13 17:04:05 +0300
committerMichael S. Tsirkin <mst@redhat.com>2018-09-07 17:05:18 -0400
commitfa4ae4be15fb08b37bec35139688ef563311d0b9 (patch)
treebc12433395cafcc2371cdc5c6849cf65b5bcca7a /hw
parentc2d2a81b4196984fb74276826892838b5b69d92c (diff)
downloadqemu-fa4ae4be15fb08b37bec35139688ef563311d0b9.zip
qemu-fa4ae4be15fb08b37bec35139688ef563311d0b9.tar.gz
qemu-fa4ae4be15fb08b37bec35139688ef563311d0b9.tar.bz2
vhost: fix invalid downcast
virtio_queue_get_desc_addr returns 64-bit hwaddr while int is usually 32-bit. If returned hwaddr is not equal to 0 but least-significant 32 bits are equal to 0 then this code will not actually stop running queue. Signed-off-by: Yury Kotov <yury-kotov@yandex-team.ru> Acked-by: Jia He <hejianet@gmail.com> Cc: qemu-stable@nongnu.org Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/virtio/vhost.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index d4cb589..569c405 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1073,10 +1073,8 @@ static void vhost_virtqueue_stop(struct vhost_dev *dev,
.index = vhost_vq_index,
};
int r;
- int a;
- a = virtio_queue_get_desc_addr(vdev, idx);
- if (a == 0) {
+ if (virtio_queue_get_desc_addr(vdev, idx) == 0) {
/* Don't stop the virtqueue which might have not been started */
return;
}