diff mbox

[01/13] Always create opal-interrupts property

Message ID 1424231849-17973-1-git-send-email-benh@kernel.crashing.org
State Accepted
Headers show

Commit Message

Benjamin Herrenschmidt Feb. 18, 2015, 3:57 a.m. UTC
Even if empty. The existing Linux code doesn't properly NULL check
the result of of_get_property() and will allocate an array of an
undefined size if the property is missing, while an empty property
is harmless.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 core/interrupts.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/core/interrupts.c b/core/interrupts.c
index df48c8d..e3a4151 100644
--- a/core/interrupts.c
+++ b/core/interrupts.c
@@ -186,10 +186,12 @@  void add_opal_interrupts(void)
 	unlock(&irq_lock);
 
 	/* The opal-interrupts property has one cell per interrupt,
-	 * it is not a standard interrupt property
+	 * it is not a standard interrupt property.
+	 *
+	 * Note: Even if empty, create it, otherwise some bogus error
+	 * handling in Linux can cause problems.
 	 */
-	if (irqs)
-		dt_add_property(opal_node, "opal-interrupts", irqs, count * 4);
+	dt_add_property(opal_node, "opal-interrupts", irqs, count * 4);
 }
 
 /*