mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-19 02:34:01 +08:00
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 <xkernel.wang@foxmail.com> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
This commit is contained in:
parent
f8f9f21c78
commit
f93e2a100e
@ -363,6 +363,8 @@ static void ip22_check_gio(int slotno, unsigned long addr, int irq)
|
||||
printk(KERN_INFO "GIO: slot %d : %s (id %x)\n",
|
||||
slotno, name, id);
|
||||
gio_dev = kzalloc(sizeof *gio_dev, GFP_KERNEL);
|
||||
if (!gio_dev)
|
||||
return;
|
||||
gio_dev->name = name;
|
||||
gio_dev->slotno = slotno;
|
||||
gio_dev->id.id = id;
|
||||
|
Loading…
Reference in New Issue
Block a user