Linux IOMMU Development
 help / color / mirror / Atom feed
* [PATCH] iommu: fix static checker warning in iommu_insert_device_resv_regions
@ 2017-02-06  9:11 Eric Auger
       [not found] ` <1486372298-20448-1-git-send-email-eric.auger-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Auger @ 2017-02-06  9:11 UTC (permalink / raw)
  To: eric.auger.pro-Re5JQEeQqe8AvxtiuMwx3w,
	eric.auger-H+wXaHxf7aLQT0dZR+AlfA, joro-zLv9SwRftAIdnm+yROfE0A,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

In case the device reserved region list is void, the returned value
of iommu_insert_device_resv_regions is uninitialized. Let's return 0
in that case.

This fixes commit 6c65fb318e8b ("iommu: iommu_get_group_resv_regions").

Reported-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Eric Auger <eric.auger-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

---

Applies on top of iommu-next
---
 drivers/iommu/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index b752c3d..f5c9279 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -205,7 +205,7 @@ iommu_insert_device_resv_regions(struct list_head *dev_resv_regions,
 				 struct list_head *group_resv_regions)
 {
 	struct iommu_resv_region *entry;
-	int ret;
+	int ret = 0;
 
 	list_for_each_entry(entry, dev_resv_regions, list) {
 		ret = iommu_insert_resv_region(entry, group_resv_regions);
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-06 13:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-06  9:11 [PATCH] iommu: fix static checker warning in iommu_insert_device_resv_regions Eric Auger
     [not found] ` <1486372298-20448-1-git-send-email-eric.auger-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-02-06 13:08   ` Joerg Roedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox