Skip to contentSkip to conversation

ARM: davinci: Check for NULL return from irq_alloc_generic_chip

PATCH New Todd Poynor 2 participants 2 messages Jul 17, 2011 – Jul 19, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ARM: davinci: Check for NULL return from irq_alloc_generic_chip

Avoid NULL dereference of irq_alloc_generic_chip return in low memory conditions.

---
Found by inspection of the source; have not witnessed an actual crash.

 arch/arm/mach-davinci/irq.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/irq.c +6 -0
index d8c1af0..952dc12 100644
@@ -52,6 +52,12 @@ davinci_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num)
 	struct irq_chip_type *ct;
 
 	gc = irq_alloc_generic_chip("AINTC", 1, irq_start, base, handle_edge_irq);
+	if (!gc) {
+		pr_err("%s: irq_alloc_generic_chip for IRQ %u failed\n",
+		       __func__, irq_start);
+		return;
+	}
+
 	ct = gc->chip_types;
 	ct->chip.irq_ack = irq_gc_ack_set_bit;
 	ct->chip.irq_mask = irq_gc_mask_clr_bit;
Signature · 1 line
1.7.3.1
#1 lore raw

PATCH v2 1/1 ARM: davinci: Check for NULL return from irq_alloc_generic_chip

Quoted 4 lines · Todd Poynor

Avoid NULL dereference of irq_alloc_generic_chip return in low memory conditions.

Thanks Todd, queuing this for v3.0.

Thanks,
Sekhar