]> git.ipfire.org Git - thirdparty/qemu.git/commit
virtio: fix up max size checks
authorMichael S. Tsirkin <mst@redhat.com>
Wed, 18 Jan 2017 19:32:22 +0000 (21:32 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 16 Mar 2017 17:10:40 +0000 (12:10 -0500)
commita626117f6ae0dfe8089c7fa263c56b105f9fd47d
tree5209282210008ad2df808d35bb71b7a26c2e14bf
parent3b33cba69ce3407866e84280ebd7a651e4425a11
virtio: fix up max size checks

Coverity reports that ARRAY_SIZE(elem->out_sg) (and all the others too)
is wrong because elem->out_sg is a pointer.

However, the check is not in the right place and the max_size argument
of virtqueue_map_iovec can be removed.  The check on in_num/out_num
should be moved to qemu_get_virtqueue_element instead, before the call
to virtqueue_alloc_element.

Cc: qemu-stable@nongnu.org
Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Fixes: 3724650db07057333879484c8bc7d900b5c1bf8e ("virtio: introduce virtqueue_alloc_element")
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
(cherry picked from commit 6bdc21c050a2a7b92cbbd0b2a1f8934e9b5f896f)
* dropped context dep on 8607f5c30
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/virtio/virtio.c