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 <s...@chromium.org>
---

Changes in v16:
- Add new patch to check for failure to create objects in selftest

Changes in v15: None
Changes in v14: None
Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v9: None
Changes in v7: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 cmd/bootefi.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 3e37805ea13..5be10c9b832 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,
-- 
2.20.0.rc0.387.gc7a69e6b6c-goog

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to