diff options
author | Tu Dinh Ngoc <dinhngoc.tu@irit.fr> | 2022-09-29 14:18:58 +0200 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2022-10-04 12:52:17 +0100 |
commit | 717a3ab0a195626360f40e9d3b4d6d8e072e83ba (patch) | |
tree | 6d1474babb083de65eb060c1663dbd739cf8f923 | |
parent | ed805be52f57934729379e0afd546b7433f7f987 (diff) | |
download | kvmtool-717a3ab0a195626360f40e9d3b4d6d8e072e83ba.tar.gz |
virtio-net: Fix vq->use_event_idx flag check
VIRTIO_RING_F_EVENT_IDX is a bit position value, but
virtio_init_device_vq populates vq->use_event_idx by ANDing this value
directly to vdev->features.
Fix the check for this flag in virtio_init_device_vq.
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Tu Dinh Ngoc <dinhngoc.tu@irit.fr>
Link: https://lore.kernel.org/r/20220929121858.156-1-dinhngoc.tu@irit.fr
Signed-off-by: Will Deacon <will@kernel.org>
-rw-r--r-- | virtio/core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/virtio/core.c b/virtio/core.c index f432421a..ea0e5b65 100644 --- a/virtio/core.c +++ b/virtio/core.c @@ -165,7 +165,7 @@ void virtio_init_device_vq(struct kvm *kvm, struct virtio_device *vdev, struct vring_addr *addr = &vq->vring_addr; vq->endian = vdev->endian; - vq->use_event_idx = (vdev->features & VIRTIO_RING_F_EVENT_IDX); + vq->use_event_idx = (vdev->features & (1UL << VIRTIO_RING_F_EVENT_IDX)); vq->enabled = true; if (addr->legacy) { |