lkml.org 
[lkml]   [2019]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] irqchip/tango: Add NULL check after memory operation
Add NULL check after kzalloc operation.

Fix below issue reported by coccicheck
./drivers/irqchip/irq-tango.c:189:1-5: alloc with no test, possible
model on line 193

Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
---
drivers/irqchip/irq-tango.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/irqchip/irq-tango.c b/drivers/irqchip/irq-tango.c
index 34290f0..761b9fa 100644
--- a/drivers/irqchip/irq-tango.c
+++ b/drivers/irqchip/irq-tango.c
@@ -187,6 +187,8 @@ static int __init tangox_irq_init(void __iomem *base, struct resource *baseres,
panic("%pOFn: failed to get address", node);

chip = kzalloc(sizeof(*chip), GFP_KERNEL);
+ if (!chip)
+ return -ENOMEM;
chip->ctl = res.start - baseres->start;
chip->base = base;

--
2.7.4
\
 
 \ /
  Last update: 2019-07-21 20:16    [W:0.064 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site