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-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 05 Nov 2013 16:21:36 +0100
From:	Tomasz Figa <t.figa@...sung.com>
To:	Olof Johansson <olof@...om.net>
Cc:	Grant Likely <grant.likely@...aro.org>, devicetree@...r.kernel.org,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Kevin Hilman <khilman@...aro.org>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>
Subject: [PATCH 2/2] of: irq: Check for reg property presence only when parsing
 interrupt-map

This patch fixes the of_irq_parse_raw() function to check for reg
property only when really parsing interrupt map property, as it is not
required otherwise and breaks existing device trees.

Signed-off-by: Tomasz Figa <t.figa@...sung.com>
---
 drivers/of/irq.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 717eed4..72e9c51 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -147,17 +147,8 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
 
 	pr_debug(" -> addrsize=%d\n", addrsize);
 
-	/* If we were passed no "reg" property and we attempt to parse
-	 * an interrupt-map, then #address-cells must be 0.
-	 * Fail if it's not.
-	 */
-	if (addr == NULL && addrsize != 0) {
-		pr_debug(" -> no reg passed in when needed !\n");
-		return -EINVAL;
-	}
-
 	/* Precalculate the match array - this simplifies match loop */
-	for (i = 0; i < addrsize; i++)
+	for (i = 0; i < addrsize && addr; i++)
 		initial_match_array[i] = addr[i];
 	for (i = 0; i < intsize; i++)
 		initial_match_array[addrsize + i] = cpu_to_be32(out_irq->args[i]);
@@ -184,6 +175,16 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
 		}
 		imaplen /= sizeof(u32);
 
+		/*
+		 * If we were passed no "reg" property and we attempt to parse
+		 * an interrupt-map, then #address-cells must be 0.
+		 * Fail if it's not.
+		 */
+		if (addr == NULL && addrsize != 0) {
+			pr_debug(" -> no reg passed in when needed !\n");
+			return -EINVAL;
+		}
+
 		/* Look for a mask */
 		imask = of_get_property(ipar, "interrupt-map-mask", NULL);
 		if (!imask)
-- 
1.8.4.2


--
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