]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
iommu: Fix static checker warning in iommu_insert_device_resv_regions
authorEric Auger <eric.auger@redhat.com>
Mon, 6 Feb 2017 09:11:38 +0000 (10:11 +0100)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 9 Mar 2017 19:08:02 +0000 (13:08 -0600)
BugLink: http://bugs.launchpad.net/bugs/1671599
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@oracle.com>
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
(cherry picked from commit a514a6e241f051dd8a4a00a456382dec0b1af21b)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/iommu/iommu.c

index f4a176e56e3914ec22724e02b9f0262aa1c22f9b..78036e1bf40038102c5d7c7bbefab23f0d543088 100644 (file)
@@ -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);