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>] [day] [month] [year] [list]
Date:	Tue, 09 Sep 2008 22:34:17 +0200
From:	roel kluin <roel.kluin@...il.com>
To:	galak@...nel.crashing.org, linux-kernel@...r.kernel.org
Subject: [PATCH] [POWERPC] unsigned hwirq cannot be negative

This patch is not tested
---
fsl_msi_alloc_hwirqs() converts an int from bitmap_find_free_region()
into an irq_hw_number_t, but this can be an -ENOMEM. This is tested
in fsl_setup_msi_irqs(), but incorrectly: irq_hw_number_t is
unsigned.

Signed-off-by: Roel Kluin <roel.kluin@...il.com>
---
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 2c5187c..a2aa59a 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -67,7 +67,7 @@ static struct irq_host_ops fsl_msi_host_ops = {
 	.map = fsl_msi_host_map,
 };
 
-static irq_hw_number_t fsl_msi_alloc_hwirqs(struct fsl_msi *msi, int num)
+static int fsl_msi_alloc_hwirqs(struct fsl_msi *msi, int num)
 {
 	unsigned long flags;
 	int order = get_count_order(num);
@@ -205,13 +205,13 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
 	struct fsl_msi *msi_data = fsl_msi;
 
 	list_for_each_entry(entry, &pdev->msi_list, list) {
-		hwirq = fsl_msi_alloc_hwirqs(msi_data, 1);
-		if (hwirq < 0) {
-			rc = hwirq;
+		rc = fsl_msi_alloc_hwirqs(msi_data, 1);
+		if (rc < 0) {
 			pr_debug("%s: fail allocating msi interrupt\n",
 					__func__);
 			goto out_free;
 		}
+		hwirq = rc;
 
 		virq = irq_create_mapping(msi_data->irqhost, hwirq);
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ