diff mbox series

[U-Boot,02/21] sandbox: Check the filename in jump_to_image_no_args()

Message ID 20181124042944.239106-3-sjg@chromium.org
State Accepted
Commit 12efc933b9e69f7340703655d84b9b610fa42fd4
Delegated to: Simon Glass
Headers show
Series Various patches for verified boot support | expand

Commit Message

Simon Glass Nov. 24, 2018, 4:29 a.m. UTC
If the filename is NULL this function currently crashes. Update it to fail
gracefully.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 arch/sandbox/cpu/spl.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Simon Glass Dec. 5, 2018, 11:11 p.m. UTC | #1
If the filename is NULL this function currently crashes. Update it to fail
gracefully.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 arch/sandbox/cpu/spl.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Applied to u-boot-dm/master, thanks!
diff mbox series

Patch

diff --git a/arch/sandbox/cpu/spl.c b/arch/sandbox/cpu/spl.c
index 5005ed2f54a..2ca4cd6e35e 100644
--- a/arch/sandbox/cpu/spl.c
+++ b/arch/sandbox/cpu/spl.c
@@ -69,7 +69,11 @@  void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
 {
 	const char *fname = spl_image->arg;
 
-	os_fd_restore();
-	os_spl_to_uboot(fname);
+	if (fname) {
+		os_fd_restore();
+		os_spl_to_uboot(fname);
+	} else {
+		printf("No filename provided for U-Boot\n");
+	}
 	hang();
 }