Skip to content

Commit d9b3ade

Browse files
Xie Yongjimstsirkin
Xie Yongji
authored andcommitted
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: 5f9ff1e ("libvhost-user: Support tracking inflight I/O in shared memory") Reported-by: Marc-André Lureau <[email protected]> Signed-off-by: Xie Yongji <[email protected]> Message-Id: <[email protected]> Reviewed-by: Marc-André Lureau <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent 39e2821 commit d9b3ade

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

contrib/libvhost-user/libvhost-user.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ vu_check_queue_inflights(VuDev *dev, VuVirtq *vq)
992992
vq->shadow_avail_idx = vq->last_avail_idx = vq->inuse + vq->used_idx;
993993

994994
if (vq->inuse) {
995-
vq->resubmit_list = malloc(sizeof(VuVirtqInflightDesc) * vq->inuse);
995+
vq->resubmit_list = calloc(vq->inuse, sizeof(VuVirtqInflightDesc));
996996
if (!vq->resubmit_list) {
997997
return -1;
998998
}

0 commit comments

Comments
 (0)