Skip to content

virtio: fix virtio_add_queue() queue size Coverity issue

Stefan Hajnoczi qemu-devel virtio-fs 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 7 repliesIn review
  2. v11 patch 2 repliesSuperseded

Changes in v2 from the cover letter

- Deal with x-override-queue-size, the root cause for the Coverity issue [Peter]

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2virtio: make virtio_add_queue() queue_size an unsigned inthw/virtio/virtio.c include/hw/virtio/virtio.h+2 -24 replies
2/2virtio: use Error for queue size validation in virtio_add_queue()hw/9pfs/virtio-9p-device.c hw/audio/virtio-snd.c hw/block/vhost-user-blk.c +21 more+120 -553 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchLaurent Vivier
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] virtio: fix virtio_add_queue() queue size Coverity issue

v2:
- Deal with x-override-queue-size, the root cause for the Coverity issue [Peter]

virtio_add_queue() uses int rather than unsigned int for the virtqueue size. It also fails to validate the x-override-queue-size qdev property. Refactor the code to solve these issues.

Patch 2 adds an Error **errp argument to virtio_add_queue() and changes all callers to pass &error_abort. This solution requires many code changes, but it's a step in the direction of propagating errors and that should be the long-term goal.

Stefan Hajnoczi (2):
virtio: make virtio_add_queue() queue_size an unsigned int
virtio: use Error for queue size validation in virtio_add_queue()

 include/hw/virtio/virtio.h     |  4 ++--
 hw/9pfs/virtio-9p-device.c     |  2 +-
 hw/audio/virtio-snd.c          |  8 +++----
 hw/block/vhost-user-blk.c      |  3 ++-
 hw/block/virtio-blk.c          |  3 ++-
 hw/char/virtio-serial-bus.c    | 14 ++++++------
 hw/display/virtio-gpu-base.c   |  8 +++----
 hw/input/virtio-input.c        |  6 ++++--
 hw/net/virtio-net.c            | 15 ++++++++-----
 hw/scsi/virtio-scsi.c          |  9 +++++---
 hw/virtio/vdpa-dev.c           |  3 ++-
 hw/virtio/vhost-user-base.c    |  3 ++-
 hw/virtio/vhost-user-fs.c      |  8 +++++--
 hw/virtio/vhost-user-scmi.c    |  6 ++++--
 hw/virtio/vhost-vsock-common.c |  9 +++++---
 hw/virtio/virtio-balloon.c     | 15 ++++++++-----
 hw/virtio/virtio-crypto.c      |  6 ++++--
 hw/virtio/virtio-iommu.c       |  6 ++++--
 hw/virtio/virtio-mem.c         |  3 ++-
 hw/virtio/virtio-nsm.c         |  2 +-
 hw/virtio/virtio-pmem.c        |  2 +-
 hw/virtio/virtio-rng.c         |  2 +-
 hw/virtio/virtio-rtc.c         |  3 ++-
 hw/virtio/virtio.c             | 39 +++++++++++++++++++++++++++++-----
 24 files changed, 122 insertions(+), 57 deletions(-)
Signature · 1 line
2.55.0