Thread (4 messages) 4 messages, 4 authors, 2021-09-07

Re: [PATCH] vdpa: potential uninitialized return in vhost_vdpa_va_map()

From: Jason Wang <hidden>
Date: 2021-09-07 09:07:36
Also in: virtualization

On Tue, Sep 7, 2021 at 3:33 PM Dan Carpenter [off-list ref] wrote:
quoted hunk ↗ jump to hunk
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 <redacted>
---
 drivers/vhost/vdpa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index d0c0fedf2c09..170166806714 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);

--
2.20.1
Acked-by: Jason Wang <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help