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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <53c31752-c8a2-4098-837e-2f84f03c8748@moroto.mountain>
Date: Wed, 24 Apr 2024 14:42:46 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Abel Vesa <abel.vesa@...aro.org>
Cc: Stephen Boyd <sboyd@...nel.org>,
	Neil Armstrong <neil.armstrong@...aro.org>,
	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH] spmi: pmic-arb: Fix of_irq_get_byname() error checking

There are two bugs in this code:
1)  The "irq" variable needs to be signed for the error handling to
    work.
2) The of_irq_get_byname() also returns zero on error so change the
   comparison from < 0 to <= 0.

Fixes: 932282f154ac ("spmi: pmic-arb: Register controller for bus instead of arbiter")
Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
---
 drivers/spmi/spmi-pmic-arb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
index 0a17ff02c827..791cdc160c51 100644
--- a/drivers/spmi/spmi-pmic-arb.c
+++ b/drivers/spmi/spmi-pmic-arb.c
@@ -1672,7 +1672,7 @@ static int spmi_pmic_arb_bus_init(struct platform_device *pdev,
 	void __iomem *intr;
 	void __iomem *cnfg;
 	int index, ret;
-	u32 irq;
+	int irq;
 
 	ctrl = devm_spmi_controller_alloc(dev, sizeof(*bus));
 	if (IS_ERR(ctrl))
@@ -1721,8 +1721,8 @@ static int spmi_pmic_arb_bus_init(struct platform_device *pdev,
 		return PTR_ERR(intr);
 
 	irq = of_irq_get_byname(node, "periph_irq");
-	if (irq < 0)
-		return irq;
+	if (irq <= 0)
+		return irq ?: -ENXIO;
 
 	bus->pmic_arb = pmic_arb;
 	bus->intr = intr;
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ