Skip to content

Commit 792a402

Browse files
GustavoARSilvatsbogend
authored andcommitted
MIPS: OCTEON: irq: Fix potential NULL pointer dereference
There is a potential NULL pointer dereference in case kzalloc() fails and returns NULL. Fix this by adding a NULL check on *cd* This bug was detected with the help of Coccinelle. Fixes: 64b139f ("MIPS: OCTEON: irq: add CIB and other fixes") Cc: [email protected] Signed-off-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent 172a37e commit 792a402

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/mips/cavium-octeon/octeon-irq.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2199,6 +2199,9 @@ static int octeon_irq_cib_map(struct irq_domain *d,
21992199
}
22002200

22012201
cd = kzalloc(sizeof(*cd), GFP_KERNEL);
2202+
if (!cd)
2203+
return -ENOMEM;
2204+
22022205
cd->host_data = host_data;
22032206
cd->bit = hw;
22042207

0 commit comments

Comments
 (0)