mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 02:10:52 +07:00
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: 14e0e6796a
("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>
This commit is contained in:
parent
f512eefc9b
commit
dee9d154f4
@ -98,8 +98,11 @@ static ssize_t debug_read_regs(struct file *file, char __user *userbuf,
|
|||||||
mutex_lock(&iommu_debug_lock);
|
mutex_lock(&iommu_debug_lock);
|
||||||
|
|
||||||
bytes = omap_iommu_dump_ctx(obj, p, count);
|
bytes = omap_iommu_dump_ctx(obj, p, count);
|
||||||
|
if (bytes < 0)
|
||||||
|
goto err;
|
||||||
bytes = simple_read_from_buffer(userbuf, count, ppos, buf, bytes);
|
bytes = simple_read_from_buffer(userbuf, count, ppos, buf, bytes);
|
||||||
|
|
||||||
|
err:
|
||||||
mutex_unlock(&iommu_debug_lock);
|
mutex_unlock(&iommu_debug_lock);
|
||||||
kfree(buf);
|
kfree(buf);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user