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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <172788381949.1442.6238243346847777696.tip-bot2@tip-bot2>
Date: Wed, 02 Oct 2024 15:43:39 -0000
From: "tip-bot2 for Charlie Jenkins" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: kernel test robot <lkp@...el.com>,
 Dan Carpenter <dan.carpenter@...aro.org>,
 Charlie Jenkins <charlie@...osinc.com>, Thomas Gleixner <tglx@...utronix.de>,
 Anup Patel <anup@...infault.org>, Alexandre Ghiti <alexghiti@...osinc.com>,
 stable@...r.kernel.org, x86@...nel.org, linux-kernel@...r.kernel.org,
 maz@...nel.org
Subject: [tip: irq/urgent] irqchip/sifive-plic: Return error code on failure

The following commit has been merged into the irq/urgent branch of tip:

Commit-ID:     6eabf656048d904d961584de2e1d45bc0854f9fb
Gitweb:        https://git.kernel.org/tip/6eabf656048d904d961584de2e1d45bc0854f9fb
Author:        Charlie Jenkins <charlie@...osinc.com>
AuthorDate:    Tue, 03 Sep 2024 16:36:19 -07:00
Committer:     Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Wed, 02 Oct 2024 15:15:33 +02:00

irqchip/sifive-plic: Return error code on failure

Set error to -ENOMEM if kcalloc() fails or if irq_domain_add_linear()
fails inside of plic_probe() instead of returning 0.

Fixes: 4d936f10ff80 ("irqchip/sifive-plic: Probe plic driver early for Allwinner D1 platform")
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
Signed-off-by: Charlie Jenkins <charlie@...osinc.com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Reviewed-by: Anup Patel <anup@...infault.org>
Reviewed-by: Alexandre Ghiti <alexghiti@...osinc.com>
Cc: stable@...r.kernel.org
Link: https://lore.kernel.org/all/20240903-correct_error_codes_sifive_plic-v1-1-d929b79663a2@rivosinc.com
Closes: https://lore.kernel.org/r/202409031122.yBh8HrxA-lkp@intel.com/
---
 drivers/irqchip/irq-sifive-plic.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
index 2f6ef5c..0b730e3 100644
--- a/drivers/irqchip/irq-sifive-plic.c
+++ b/drivers/irqchip/irq-sifive-plic.c
@@ -626,8 +626,10 @@ static int plic_probe(struct fwnode_handle *fwnode)
 
 		handler->enable_save = kcalloc(DIV_ROUND_UP(nr_irqs, 32),
 					       sizeof(*handler->enable_save), GFP_KERNEL);
-		if (!handler->enable_save)
+		if (!handler->enable_save) {
+			error = -ENOMEM;
 			goto fail_cleanup_contexts;
+		}
 done:
 		for (hwirq = 1; hwirq <= nr_irqs; hwirq++) {
 			plic_toggle(handler, hwirq, 0);
@@ -639,8 +641,10 @@ done:
 
 	priv->irqdomain = irq_domain_create_linear(fwnode, nr_irqs + 1,
 						   &plic_irqdomain_ops, priv);
-	if (WARN_ON(!priv->irqdomain))
+	if (WARN_ON(!priv->irqdomain)) {
+		error = -ENOMEM;
 		goto fail_cleanup_contexts;
+	}
 
 	/*
 	 * We can have multiple PLIC instances so setup global state

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ