aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorCaleb Connolly2024-03-18 23:16:36 +0000
committerTom Rini2024-04-10 09:26:00 -0600
commitae8e1d5aa46034963bca28fb07dac76970f718fe (patch)
tree69d3c78f88f5ec02b4678a76f79cca33db0b0e4f /cmd
parent4b36f01201bfb62aba2669230436e5012dc60533 (diff)
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 <caleb.connolly@linaro.org>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/sysboot.c4
1 files changed, 4 insertions, 0 deletions
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);