Add BUG_ON check to make sure virtqueue_set_dma_premapped() is not misused. This function must be called immediately after creating the vq, or after vq reset, and before adding any buffers to it. Signed-off-by: Xuan Zhuo <xuanzhuo@xxxxxxxxxxxxxxxxx> --- drivers/virtio/virtio_ring.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 51d8f3299c10..3a3232272067 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -2793,10 +2793,7 @@ int virtqueue_set_dma_premapped(struct virtqueue *_vq) num = vq->packed_ring ? vq->packed.vring.num : vq->split.vring.num; - if (num != vq->vq.num_free) { - END_USE(vq); - return -EINVAL; - } + BUG_ON(num != vq->vq.num_free); if (!vq->use_dma_api) { END_USE(vq); -- 2.32.0.3.g01195cf9f _______________________________________________ Virtualization mailing list Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/virtualization