mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-24 06:24:17 +00:00
cmd: efidebug: check pointer after memory allocation
After calling efi_alloc() we must check that the return value is not NULL.
Fixes: f01c961ee3
("cmd: efidebug: add uri device path")
Addresses-Coverity-ID: 477185 Dereference null return value
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
This commit is contained in:
parent
b20c9c3d86
commit
55125bbfb4
1 changed files with 4 additions and 0 deletions
|
@ -754,6 +754,10 @@ static int efi_boot_add_uri(int argc, char *const argv[], u16 *var_name16,
|
||||||
|
|
||||||
uridp_len = sizeof(struct efi_device_path) + strlen(argv[3]) + 1;
|
uridp_len = sizeof(struct efi_device_path) + strlen(argv[3]) + 1;
|
||||||
uridp = efi_alloc(uridp_len + sizeof(END));
|
uridp = efi_alloc(uridp_len + sizeof(END));
|
||||||
|
if (!uridp) {
|
||||||
|
log_err("Out of memory\n");
|
||||||
|
return CMD_RET_FAILURE;
|
||||||
|
}
|
||||||
uridp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE;
|
uridp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE;
|
||||||
uridp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_URI;
|
uridp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_URI;
|
||||||
uridp->dp.length = uridp_len;
|
uridp->dp.length = uridp_len;
|
||||||
|
|
Loading…
Add table
Reference in a new issue