From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Fri, 23 Nov 2018 21:29:25 -0700 Subject: [U-Boot] [PATCH 02/21] sandbox: Check the filename in jump_to_image_no_args() In-Reply-To: <20181124042944.239106-1-sjg@chromium.org> References: <20181124042944.239106-1-sjg@chromium.org> Message-ID: <20181124042944.239106-3-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de If the filename is NULL this function currently crashes. Update it to fail gracefully. Signed-off-by: Simon Glass --- arch/sandbox/cpu/spl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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(); } -- 2.20.0.rc0.387.gc7a69e6b6c-goog