summaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2020-07-14 20:22:11 +0100
committerJoerg Roedel <jroedel@suse.de>2020-07-22 15:02:33 +0200
commitdee9d154f40c58d02f69acdaa5cfd1eae6ebc28b (patch)
tree07c86380271daa87dd0f29c135653912820639a9 /drivers/iommu
parentf512eefc9bf94e4f943c95833518bdbc80c93f0e (diff)
downloadlinux-dee9d154f40c58d02f69acdaa5cfd1eae6ebc28b.tar.bz2
iommu/omap: Check for failure of a call to omap_iommu_dump_ctx
It is possible for the call to omap_iommu_dump_ctx to return a negative error number, so check for the failure and return the error number rather than pass the negative value to simple_read_from_buffer. Fixes: 14e0e6796a0d ("OMAP: iommu: add initial debugfs support") Signed-off-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20200714192211.744776-1-colin.king@canonical.com Addresses-Coverity: ("Improper use of negative value") Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/omap-iommu-debug.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c
index 8e19bfa94121..a99afb5d9011 100644
--- a/drivers/iommu/omap-iommu-debug.c
+++ b/drivers/iommu/omap-iommu-debug.c
@@ -98,8 +98,11 @@ static ssize_t debug_read_regs(struct file *file, char __user *userbuf,
mutex_lock(&iommu_debug_lock);
bytes = omap_iommu_dump_ctx(obj, p, count);
+ if (bytes < 0)
+ goto err;
bytes = simple_read_from_buffer(userbuf, count, ppos, buf, bytes);
+err:
mutex_unlock(&iommu_debug_lock);
kfree(buf);