From: Caleb Connolly Date: Mon, 18 Mar 2024 23:16:36 +0000 (+0000) Subject: cmd: sysboot: null check filename X-Git-Tag: v2024.07-rc1~82 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae8e1d5aa46034963bca28fb07dac76970f718fe;p=pandora-u-boot.git cmd: sysboot: null check filename Currently if ${bootfile} is unset and sysboot is invoked with no filename specified then U-Boot will crash will a null-pointer dereference. Add the missing check and a matching error print. Fixes: 993c912d304d ("cmd: sysboot: Create a sysboot command dedicated file") Signed-off-by: Caleb Connolly --- diff --git a/cmd/sysboot.c b/cmd/sysboot.c index 63a7806debe..d14c570d96a 100644 --- a/cmd/sysboot.c +++ b/cmd/sysboot.c @@ -77,6 +77,10 @@ static int do_sysboot(struct cmd_tbl *cmdtp, int flag, int argc, if (argc < 6) { filename = env_get("bootfile"); + if (!filename) { + printf("Specify a filename or set the ${bootfile} environment variable\n"); + return 1; + } } else { filename = argv[5]; env_set("bootfile", filename);