]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
sandbox: Check the filename in jump_to_image_no_args()
authorSimon Glass <sjg@chromium.org>
Sat, 24 Nov 2018 04:29:25 +0000 (21:29 -0700)
committerSimon Glass <sjg@chromium.org>
Wed, 5 Dec 2018 13:01:34 +0000 (06:01 -0700)
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

index 5005ed2f54a5506ba1b50f9d2dce04d1eec4ca79..2ca4cd6e35ece6d439e501ffed26881768caa35d 100644 (file)
@@ -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();
 }