[Skiboot] [PATCH 01/13] Always create opal-interrupts property

Benjamin Herrenschmidt benh at kernel.crashing.org
Wed Feb 18 14:57:17 AEDT 2015


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 at kernel.crashing.org>
---
 core/interrupts.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

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);
 }
 
 /*
-- 
2.1.0



More information about the Skiboot mailing list