Skip to content

Commit dee9d15

Browse files
Colin Ian Kingjoergroedel
authored andcommitted
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: 14e0e67 ("OMAP: iommu: add initial debugfs support") Signed-off-by: Colin Ian King <[email protected]> Link: https://lore.kernel.org/r/[email protected] Addresses-Coverity: ("Improper use of negative value") Signed-off-by: Joerg Roedel <[email protected]>
1 parent f512eef commit dee9d15

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/iommu/omap-iommu-debug.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,11 @@ static ssize_t debug_read_regs(struct file *file, char __user *userbuf,
9898
mutex_lock(&iommu_debug_lock);
9999

100100
bytes = omap_iommu_dump_ctx(obj, p, count);
101+
if (bytes < 0)
102+
goto err;
101103
bytes = simple_read_from_buffer(userbuf, count, ppos, buf, bytes);
102104

105+
err:
103106
mutex_unlock(&iommu_debug_lock);
104107
kfree(buf);
105108

0 commit comments

Comments
 (0)