diff options
| author | Xie Yongji | 2019-11-19 08:57:59 +0100 |
|---|---|---|
| committer | Michael S. Tsirkin | 2019-11-20 10:57:22 +0100 |
| commit | d9b3ade54ea7465093578cd0f792437198b572ac (patch) | |
| tree | b9ceb04c020b48afe7336b5a01870173170f9727 | |
| parent | Update version for v4.2.0-rc2 release (diff) | |
| download | qemu-d9b3ade54ea7465093578cd0f792437198b572ac.tar.gz qemu-d9b3ade54ea7465093578cd0f792437198b572ac.tar.xz qemu-d9b3ade54ea7465093578cd0f792437198b572ac.zip | |
libvhost-user: Zero memory allocated for VuVirtqInflightDesc
Use a zero-initialized VuVirtqInflightDesc struct to avoid
that scan-build reports that vq->resubmit_list[0].counter may
be garbage value in vu_check_queue_inflights().
Fixes: 5f9ff1eff ("libvhost-user: Support tracking inflight I/O in
shared memory")
Reported-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Xie Yongji <xieyongji@baidu.com>
Message-Id: <20191119075759.4334-1-xieyongji@baidu.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
| -rw-r--r-- | contrib/libvhost-user/libvhost-user.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c index 68c27136ae..ec27b78ff1 100644 --- a/contrib/libvhost-user/libvhost-user.c +++ b/contrib/libvhost-user/libvhost-user.c @@ -992,7 +992,7 @@ vu_check_queue_inflights(VuDev *dev, VuVirtq *vq) vq->shadow_avail_idx = vq->last_avail_idx = vq->inuse + vq->used_idx; if (vq->inuse) { - vq->resubmit_list = malloc(sizeof(VuVirtqInflightDesc) * vq->inuse); + vq->resubmit_list = calloc(vq->inuse, sizeof(VuVirtqInflightDesc)); if (!vq->resubmit_list) { return -1; } |
