From: Evgeny Kuznetsov Date: Wed, 8 Dec 2010 00:25:40 +0000 (-0800) Subject: omap: Ptr "isr_reg" tracked as NULL was dereferenced X-Git-Tag: firefly_0821_release~7613^2~3115^2~56 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b1cc4c55c69efed3ebbb2a13e4c77a2a1a4a6bc9;p=firefly-linux-kernel-4.4.55.git omap: Ptr "isr_reg" tracked as NULL was dereferenced Value of "isr_reg" pointer is depend on configuration and GPIO method. Potentially it may have NULL value and it is dereferenced later in code. Warning and exit from function are added in this case. Signed-off-by: Evgeny Kuznetsov Signed-off-by: Tony Lindgren --- diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index c05c653d1674..e0e2fa725269 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -1318,6 +1318,10 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) if (bank->method == METHOD_GPIO_44XX) isr_reg = bank->base + OMAP4_GPIO_IRQSTATUS0; #endif + + if (WARN_ON(!isr_reg)) + goto exit; + while(1) { u32 isr_saved, level_mask = 0; u32 enabled; @@ -1377,6 +1381,7 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) configured, we must unmask the bank interrupt only after handler(s) are executed in order to avoid spurious bank interrupt */ +exit: if (!unmasked) desc->chip->unmask(irq);