mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-28 23:50:26 +09:00
efi_loader: efi_net: check return value of calloc
Calloc may return NULL. So we must check the return value. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
93945f2c65
commit
cb90ee9757
@ -292,6 +292,10 @@ int efi_net_register(void)
|
|||||||
|
|
||||||
/* We only expose the "active" eth device, so one is enough */
|
/* We only expose the "active" eth device, so one is enough */
|
||||||
netobj = calloc(1, sizeof(*netobj));
|
netobj = calloc(1, sizeof(*netobj));
|
||||||
|
if (!netobj) {
|
||||||
|
printf("ERROR: Out of memory\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Fill in object data */
|
/* Fill in object data */
|
||||||
netobj->parent.protocols[0].guid = &efi_net_guid;
|
netobj->parent.protocols[0].guid = &efi_net_guid;
|
||||||
|
Loading…
Reference in New Issue
Block a user