diff options
author | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2024-01-11 09:25:35 +0100 |
---|---|---|
committer | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2024-01-13 18:17:47 +0100 |
commit | 55125bbfb48cb1330a692059bc972810f77b984a (patch) | |
tree | b603968cc2de846e26382fd9e52945abf2391526 /cmd | |
parent | b20c9c3d8681547f7c839bb4f6fcd2f31e2b8585 (diff) | |
download | u-boot-55125bbfb48cb1330a692059bc972810f77b984a.tar.gz u-boot-55125bbfb48cb1330a692059bc972810f77b984a.tar.bz2 u-boot-55125bbfb48cb1330a692059bc972810f77b984a.zip |
cmd: efidebug: check pointer after memory allocation
After calling efi_alloc() we must check that the return value is not NULL.
Fixes: f01c961ee34c ("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>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/efidebug.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cmd/efidebug.c b/cmd/efidebug.c index 836014ab8e..aa8523797e 100644 --- a/cmd/efidebug.c +++ b/cmd/efidebug.c @@ -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 = 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.sub_type = DEVICE_PATH_SUB_TYPE_MSG_URI; uridp->dp.length = uridp_len; |