aboutsummaryrefslogtreecommitdiff
path: root/hw/core
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2024-02-06 14:06:07 -0500
committerKevin Wolf <kwolf@redhat.com>2024-02-07 14:44:09 +0100
commit5fbcbd50fca67ffe35317f2e86f6822aa22e41c6 (patch)
treea5188225b0e671801411fe46e81145cce640e377 /hw/core
parent1f995a4782d140b16d9b24e787053944fb5c4dfb (diff)
downloadqemu-5fbcbd50fca67ffe35317f2e86f6822aa22e41c6.zip
qemu-5fbcbd50fca67ffe35317f2e86f6822aa22e41c6.tar.gz
qemu-5fbcbd50fca67ffe35317f2e86f6822aa22e41c6.tar.bz2
virtio-blk: clarify that there is at least 1 virtqueue
It is not possible to instantiate a virtio-blk device with 0 virtqueues. The following check is located in ->realize(): if (!conf->num_queues) { error_setg(errp, "num-queues property must be larger than 0"); return; } Later on we access s->vq_aio_context[0] under the assumption that there is as least one virtqueue. Hanna Czenczek <hreitz@redhat.com> noted that it would help to show that the array index is already valid. Add an assertion to document that s->vq_aio_context[0] is always safe...and catch future code changes that break this assumption. Suggested-by: Hanna Czenczek <hreitz@redhat.com> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Reviewed-by: Hanna Czenczek <hreitz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-ID: <20240206190610.107963-3-stefanha@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/core')
0 files changed, 0 insertions, 0 deletions