Thread (6 messages) 6 messages, 6 authors, 2021-02-09

Re: [PATCH][next] iommu/mediatek: Fix unsigned domid comparison with less than zero

From: Joerg Roedel <joro@8bytes.org>
Date: 2021-02-04 13:33:11
Also in: kernel-janitors, linux-arm-kernel, linux-iommu, lkml

On Thu, Feb 04, 2021 at 09:25:58AM +0000, Will Deacon wrote:
On Wed, Feb 03, 2021 at 01:59:36PM +0000, Colin King wrote:
quoted
From: Colin Ian King <redacted>

Currently the check for domid < 0 is always false because domid
is unsigned.  Fix this by making it signed.

Addresses-CoverityL ("Unsigned comparison against 0")
Typo here ('L' instead of ':')
quoted
Fixes: ab1d5281a62b ("iommu/mediatek: Add iova reserved function")
Signed-off-by: Colin Ian King <redacted>
---
 drivers/iommu/mtk_iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 0ad14a7604b1..823d719945b2 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -640,7 +640,7 @@ static void mtk_iommu_get_resv_regions(struct device *dev,
 				       struct list_head *head)
 {
 	struct mtk_iommu_data *data = dev_iommu_priv_get(dev);
-	unsigned int domid = mtk_iommu_get_domain_id(dev, data->plat_data), i;
+	int domid = mtk_iommu_get_domain_id(dev, data->plat_data), i;
Not sure if it's intentional, but this also makes 'i' signed. It probably
should remain 'unsigned' to match 'iova_region_nr' in
'struct mtk_iommu_plat_data'.
Yes, 'i' should stay unsigned. Colin, can you please fix that up and
re-send?

Thanks,

	Joerg

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help