lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230704115634.7727-1-yong.wu@mediatek.com>
Date:   Tue, 4 Jul 2023 19:56:34 +0800
From:   Yong Wu <yong.wu@...iatek.com>
To:     Joerg Roedel <joro@...tes.org>,
        Matthias Brugger <matthias.bgg@...il.com>
CC:     Will Deacon <will@...nel.org>, Robin Murphy <robin.murphy@....com>,
        AngeloGioacchino Del Regno 
        <angelogioacchino.delregno@...labora.com>,
        Yong Wu <yong.wu@...iatek.com>, <iommu@...ts.linux.dev>,
        <linux-mediatek@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>
Subject: [PATCH] iommu/mediatek: Remove a unnecessary checking for larbid

Fix a coverity issue:

>>assignment: Assigning: larbid = (fwspec->ids[0] >> 5) & 0x1fU.
	larbid = MTK_M4U_TO_LARB(fwspec->ids[0]);
>>between: At condition larbid >= 32U, the value of larbid must be between
>>0 and 31.
>>dead_error_condition: The condition larbid >= 32U cannot be true.
	if (larbid >= MTK_LARB_NR_MAX)
>>CID 11306470 (#1 of 1): Logically dead code (DEADCODE)
>>dead_error_line: Execution cannot reach this statement:
>>return ERR_PTR(-22L);
        	return ERR_PTR(-EINVAL);

The checking "if (larbid >= MTK_LARB_NR_MAX)" is unnecessary.

Signed-off-by: Yong Wu <yong.wu@...iatek.com>
---
Rebase on v6.4-rc1.
---
 drivers/iommu/mtk_iommu.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index aecc7d154f28..67caa90b481b 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -838,9 +838,6 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
 	 * All the ports in each a device should be in the same larbs.
 	 */
 	larbid = MTK_M4U_TO_LARB(fwspec->ids[0]);
-	if (larbid >= MTK_LARB_NR_MAX)
-		return ERR_PTR(-EINVAL);
-
 	for (i = 1; i < fwspec->num_ids; i++) {
 		larbidx = MTK_M4U_TO_LARB(fwspec->ids[i]);
 		if (larbid != larbidx) {
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ