[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1483949306-9712-1-git-send-email-arvind.yadav.cs@gmail.com>
Date: Mon, 9 Jan 2017 13:38:26 +0530
From: Arvind Yadav <arvind.yadav.cs@...il.com>
To: tglx@...utronix.de, jason@...edaemon.net, marc.zyngier@....com
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH v1] irqchip: irq-mips-gic:- Handle return NULL error from ioremap_nocache
Here, If ioremap_nocache will fail. It will return NULL.
Kernel can run into a NULL-pointer dereference.
This error check will avoid NULL pointer dereference.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@...il.com>
---
drivers/irqchip/irq-mips-gic.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c
index c01c09e..eeea2e8 100644
--- a/drivers/irqchip/irq-mips-gic.c
+++ b/drivers/irqchip/irq-mips-gic.c
@@ -979,6 +979,8 @@ static void __init __gic_init(unsigned long gic_base_addr,
__gic_base_addr = gic_base_addr;
gic_base = ioremap_nocache(gic_base_addr, gic_addrspace_size);
+ if (!gic_base)
+ panic("Failed to map GIC memory");
gicconfig = gic_read(GIC_REG(SHARED, GIC_SH_CONFIG));
gic_shared_intrs = (gicconfig & GIC_SH_CONFIG_NUMINTRS_MSK) >>
--
1.9.1
Powered by blists - more mailing lists