Skip to content

Commit b9b2092

Browse files
Colin Ian Kinggregkh
authored andcommitted
iommu/omap: Check for failure of a call to omap_iommu_dump_ctx
[ Upstream commit dee9d15 ] 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 <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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 0b80d3c commit b9b2092

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/iommu/omap-iommu-debug.c

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

103103
bytes = omap_iommu_dump_ctx(obj, p, count);
104+
if (bytes < 0)
105+
goto err;
104106
bytes = simple_read_from_buffer(userbuf, count, ppos, buf, bytes);
105107

108+
err:
106109
mutex_unlock(&iommu_debug_lock);
107110
kfree(buf);
108111

0 commit comments

Comments
 (0)