* [PATCH] OMAP: iommu: check for failure of a call to omap_iommu_dump_ctx
@ 2020-07-14 19:22 Colin King
2020-07-22 13:03 ` Joerg Roedel
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2020-07-14 19:22 UTC (permalink / raw)
To: Joerg Roedel, Tony Lindgren, Hiroshi DOYU, iommu
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
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.
Addresses-Coverity: ("Improper use of negative value")
Fixes: 14e0e6796a0d ("OMAP: iommu: add initial debugfs support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/iommu/omap-iommu-debug.c | 3 +++
1 file changed, 3 insertions(+)
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);
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] OMAP: iommu: check for failure of a call to omap_iommu_dump_ctx
2020-07-14 19:22 [PATCH] OMAP: iommu: check for failure of a call to omap_iommu_dump_ctx Colin King
@ 2020-07-22 13:03 ` Joerg Roedel
0 siblings, 0 replies; 2+ messages in thread
From: Joerg Roedel @ 2020-07-22 13:03 UTC (permalink / raw)
To: Colin King
Cc: Tony Lindgren, kernel-janitors, iommu, Hiroshi DOYU, linux-kernel
On Tue, Jul 14, 2020 at 08:22:11PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> 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.
>
> Addresses-Coverity: ("Improper use of negative value")
> Fixes: 14e0e6796a0d ("OMAP: iommu: add initial debugfs support")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/iommu/omap-iommu-debug.c | 3 +++
> 1 file changed, 3 insertions(+)
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-07-22 13:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-14 19:22 [PATCH] OMAP: iommu: check for failure of a call to omap_iommu_dump_ctx Colin King
2020-07-22 13:03 ` Joerg Roedel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).