Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu/mediatek: Fix forever loop in error handling
@ 2022-12-07 15:56 Dan Carpenter
  2022-12-08  1:06 ` Yong Wu (吴勇)
  2022-12-12 11:06 ` Joerg Roedel
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2022-12-07 15:56 UTC (permalink / raw)
  To: Yong Wu
  Cc: Joerg Roedel, Will Deacon, Robin Murphy, Matthias Brugger,
	AngeloGioacchino Del Regno, iommu, linux-mediatek,
	kernel-janitors

There is a typo so this loop does i++ where i-- was intended.  It will
result in looping until the kernel crashes.

Fixes: 26593928564c ("iommu/mediatek: Add error path for loop of mm_dts_parse")
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
 drivers/iommu/mtk_iommu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 3e46bc8b0714..2badd6acfb23 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -1160,8 +1160,7 @@ static int mtk_iommu_mm_dts_parse(struct device *dev, struct component_match **m
 	return 0;
 
 err_larbdev_put:
-	/* id may be not linear mapping, loop whole the array */
-	for (i = MTK_LARB_NR_MAX - 1; i >= 0; i++) {
+	for (i = MTK_LARB_NR_MAX - 1; i >= 0; i--) {
 		if (!data->larb_imu[i].dev)
 			continue;
 		put_device(data->larb_imu[i].dev);
-- 
2.35.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-12 11:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-07 15:56 [PATCH] iommu/mediatek: Fix forever loop in error handling Dan Carpenter
2022-12-08  1:06 ` Yong Wu (吴勇)
2022-12-09  2:20   ` Yong Wu (吴勇)
2022-12-12 11:06 ` Joerg Roedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox