From: Dan Carpenter Date: Tue, 7 Sep 2021 07:32:53 +0000 (+0300) Subject: vdpa: potential uninitialized return in vhost_vdpa_va_map() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=be9c6bad9b46451ba5bb8d366c51e2475f374981;p=linux.git vdpa: potential uninitialized return in vhost_vdpa_va_map() The concern here is that "ret" can be uninitialized if we hit the "goto next" condition on every iteration through the loop. Fixes: 41ba1b5f9d4b ("vdpa: Support transferring virtual addressing during DMA mapping") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/20210907073253.GB18254@kili Signed-off-by: Michael S. Tsirkin Reviewed-by: Xie Yongji Acked-by: Jason Wang Reviewed-by: Stefano Garzarella --- diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index f41d081777f58..35927ceb26ff3 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -640,7 +640,7 @@ static int vhost_vdpa_va_map(struct vhost_vdpa *v, u64 offset, map_size, map_iova = iova; struct vdpa_map_file *map_file; struct vm_area_struct *vma; - int ret; + int ret = 0; mmap_read_lock(dev->mm);