diff options
| author | Eugenio Pérez <eperezma@redhat.com> | 2026-03-04 18:35:29 +0100 |
|---|---|---|
| committer | Michael Tokarev <mjt@tls.msk.ru> | 2026-06-16 19:27:23 +0300 |
| commit | 99685f9b0f50e42afb818d6e3f9fe893705c3c80 (patch) | |
| tree | c90fa7e8cb93177b36937cc9e77c517801f944a9 | |
| parent | 15e63b7baf011f154bab0d52f33d3876fa7b97a8 (diff) | |
| download | qemu-99685f9b0f50e42afb818d6e3f9fe893705c3c80.tar.gz qemu-99685f9b0f50e42afb818d6e3f9fe893705c3c80.zip | |
virtio: Allow to fill a whole virtqueue in order
As the while steps < max_steps is already one less than the vq size, the
right maximum max_steps variable is queue length, not the maximum
possible remainder of % vq->vring.num.
Fixes: b44135daa37 ("virtio: virtqueue_ordered_fill - VIRTIO_F_IN_ORDER support")
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20260304173535.2702587-2-eperezma@redhat.com>
(cherry picked from commit eceff0982f97cc79a26883b93f8eac05cd126dd8)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
| -rw-r--r-- | hw/virtio/virtio.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index deb7c6695e..4712a9a822 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -963,7 +963,7 @@ static void virtqueue_ordered_fill(VirtQueue *vq, const VirtQueueElement *elem, * We shouldn't need to increase 'i' by more than or equal to * the distance between used_idx and last_avail_idx (max_steps). */ - max_steps = (vq->last_avail_idx - vq->used_idx) % vq->vring.num; + max_steps = MIN(vq->last_avail_idx - vq->used_idx, vq->vring.num); /* Search for element in vq->used_elems */ while (steps < max_steps) { |
