diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2024-02-06 14:06:07 -0500 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2024-02-07 14:44:09 +0100 |
commit | 5fbcbd50fca67ffe35317f2e86f6822aa22e41c6 (patch) | |
tree | a5188225b0e671801411fe46e81145cce640e377 /hw/s390x | |
parent | 1f995a4782d140b16d9b24e787053944fb5c4dfb (diff) | |
download | qemu-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/s390x')
0 files changed, 0 insertions, 0 deletions