Skip to contentSkip to conversation

vdpa: potential uninitialized return in vhost_vdpa_va_map()

PATCH In review Dan Carpenter 4 participants 4 messages Sep 7, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 drivers/vhost/vdpa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vhost/vdpa.c +1 -1
index d0c0fedf2c09..170166806714 100644
@@ -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);
 
Signature · 6 lines
2.20.1

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Dan Carpenter

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")
---
 drivers/vhost/vdpa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Acked-by on v1 1/1
#2 lore raw
In reply to Dan Carpenter
Quoted 24 lines · Dan Carpenter

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")
---
 drivers/vhost/vdpa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vhost/vdpa.c +1 -2
index d0c0fedf2c09..170166806714 100644
@@ -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);
 
--
Quoted 2 lines

2.20.1

Reviewed-by on v1 1/1
#3 lore raw
In reply to Dan Carpenter
Quoted 30 lines · Dan Carpenter

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")

---
drivers/vhost/vdpa.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vhost/vdpa.c +1 -1
index d0c0fedf2c09..170166806714 100644
@@ -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);
 
Signature · 6 lines
2.20.1

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization