[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/6] vdpa: Fix bad index calculus at vhost_vdpa_get_vring_base
From: |
Eugenio Pérez |
Subject: |
[PATCH 3/6] vdpa: Fix bad index calculus at vhost_vdpa_get_vring_base |
Date: |
Thu, 12 May 2022 19:57:44 +0200 |
Fixes: 6d0b222666 ("vdpa: Adapt vhost_vdpa_get_vring_base to SVQ")
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
hw/virtio/vhost-vdpa.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index a30510ed17..493269b0b5 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -1172,11 +1172,11 @@ static int vhost_vdpa_get_vring_base(struct vhost_dev
*dev,
struct vhost_vring_state *ring)
{
struct vhost_vdpa *v = dev->opaque;
+ int vdpa_idx = ring->index - dev->vq_index;
int ret;
if (v->shadow_vqs_enabled) {
- VhostShadowVirtqueue *svq = g_ptr_array_index(v->shadow_vqs,
- ring->index);
+ VhostShadowVirtqueue *svq = g_ptr_array_index(v->shadow_vqs, vdpa_idx);
/*
* Setting base as last used idx, so destination will see as available
--
2.27.0
- [PATCH 0/6] Shadow VirtQueue Fixes, Eugenio Pérez, 2022/05/12
- [PATCH 2/6] vhost: Fix device's used descriptor dequeue, Eugenio Pérez, 2022/05/12
- [PATCH 1/6] vhost: Track descriptor chain in private at SVQ, Eugenio Pérez, 2022/05/12
- [PATCH 3/6] vdpa: Fix bad index calculus at vhost_vdpa_get_vring_base,
Eugenio Pérez <=
- [PATCH 4/6] vdpa: Fix index calculus at vhost_vdpa_svqs_start, Eugenio Pérez, 2022/05/12
- [PATCH 5/6] hw/virtio: Replace g_memdup() by g_memdup2(), Eugenio Pérez, 2022/05/12
- [PATCH 6/6] vhost: Fix element in vhost_svq_add failure, Eugenio Pérez, 2022/05/12