summaryrefslogtreecommitdiff
path: root/cmd/bootefi.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-11-25 20:14:36 -0700
committerAlexander Graf <agraf@suse.de>2018-12-02 21:59:37 +0100
commit2ab7ef74cd90a6d60df6aad7dac24b6a2bb1fe85 (patch)
treeeb413e971c3ca5552917cb96ec77781efdedc902 /cmd/bootefi.c
parent7b78d6438a2b3a7f58a34934b54a1a83733b8fdd (diff)
downloadu-boot-2ab7ef74cd90a6d60df6aad7dac24b6a2bb1fe85.tar.gz
efi: Check for failure to create objects in selftest
At present a few error conditions are not checked. Before refactoring this code, add some basic checks. Note that this code still leaks memory in the event of error. This will be tackled after the refactor. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'cmd/bootefi.c')
-rw-r--r--cmd/bootefi.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 3e37805ea1..5be10c9b83 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -532,7 +532,12 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
bootefi_device_path = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE,
(uintptr_t)&efi_selftest,
(uintptr_t)&efi_selftest);
+ if (!bootefi_device_path)
+ return CMD_RET_FAILURE;
+
bootefi_image_path = efi_dp_from_file(NULL, 0, "\\selftest");
+ if (!bootefi_image_path)
+ return CMD_RET_FAILURE;
r = efi_setup_loaded_image(bootefi_device_path,
bootefi_image_path, &image_obj,