mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
efi_loader: efi_dp_part_node check dp_alloc return value
dp_alloc() may return NULL. This needs to be caught.
Fixes: 98d48bdf41
("efi_loader: provide a function to create a partition node")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
parent
80fadf4af6
commit
01caf28778
2 changed files with 7 additions and 1 deletions
|
@ -936,7 +936,8 @@ struct efi_device_path *efi_dp_part_node(struct blk_desc *desc, int part)
|
|||
dpsize = sizeof(struct efi_device_path_hard_drive_path);
|
||||
buf = dp_alloc(dpsize);
|
||||
|
||||
dp_part_node(buf, desc, part);
|
||||
if (buf)
|
||||
dp_part_node(buf, desc, part);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
|
|
@ -415,6 +415,11 @@ static efi_status_t efi_disk_add_dev(
|
|||
struct efi_handler *handler;
|
||||
void *protocol_interface;
|
||||
|
||||
if (!node) {
|
||||
ret = EFI_OUT_OF_RESOURCES;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Parent must expose EFI_BLOCK_IO_PROTOCOL */
|
||||
ret = efi_search_protocol(parent, &efi_block_io_guid, &handler);
|
||||
if (ret != EFI_SUCCESS)
|
||||
|
|
Loading…
Reference in a new issue