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]
Date: Fri, 22 Mar 2024 17:00:02 +0800
From: Qingfang Deng <dqfext@...il.com>
To: Thomas Gleixner <tglx@...utronix.de>,
	Palmer Dabbelt <palmer@...belt.com>,
	Paul Walmsley <paul.walmsley@...ive.com>,
	Albert Ou <aou@...s.berkeley.edu>,
	Atish Patra <atishp@...shpatra.org>,
	linux-kernel@...r.kernel.org,
	linux-riscv@...ts.infradead.org
Cc: Christoph Hellwig <hch@....de>,
	Qingfang Deng <qingfang.deng@...lower.com.cn>
Subject: [PATCH] irqchip/sifive-plic: Fix error handling of of_property_read_u32

From: Qingfang Deng <qingfang.deng@...lower.com.cn>

nr_irqs will not be initialized if of_property_read_u32 returns an
error. Check the error first.

Fixes: 8237f8bc4f6e ("irqchip: add a SiFive PLIC driver")
Signed-off-by: Qingfang Deng <qingfang.deng@...lower.com.cn>
---
 drivers/irqchip/irq-sifive-plic.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
index 5b7bc4fd9517..f436b61d74b0 100644
--- a/drivers/irqchip/irq-sifive-plic.c
+++ b/drivers/irqchip/irq-sifive-plic.c
@@ -428,8 +428,11 @@ static int __init __plic_init(struct device_node *node,
 		goto out_free_priv;
 	}
 
+	error = of_property_read_u32(node, "riscv,ndev", &nr_irqs);
+	if (error)
+		goto out_iounmap;
+
 	error = -EINVAL;
-	of_property_read_u32(node, "riscv,ndev", &nr_irqs);
 	if (WARN_ON(!nr_irqs))
 		goto out_iounmap;
 
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ