Skip to content

Commit f93e2a1

Browse files
x2018tsbogend
authored andcommitted
mips: sgi-ip22: add a check for the return of kzalloc()
kzalloc() is a memory allocation function which can return NULL when some internal memory errors happen. So it is better to check it to prevent potential wrong memory access. Signed-off-by: Xiaoke Wang <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent f8f9f21 commit f93e2a1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arch/mips/sgi-ip22/ip22-gio.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,8 @@ static void ip22_check_gio(int slotno, unsigned long addr, int irq)
363363
printk(KERN_INFO "GIO: slot %d : %s (id %x)\n",
364364
slotno, name, id);
365365
gio_dev = kzalloc(sizeof *gio_dev, GFP_KERNEL);
366+
if (!gio_dev)
367+
return;
366368
gio_dev->name = name;
367369
gio_dev->slotno = slotno;
368370
gio_dev->id.id = id;

0 commit comments

Comments
 (0)