All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cmd: sysboot: null check filename
@ 2024-03-18 23:16 Caleb Connolly
  2024-04-10 17:43 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Caleb Connolly @ 2024-03-18 23:16 UTC (permalink / raw)
  To: Caleb Connolly, Patrice Chotard, Ramon Fried, Sean Edmond, Tom Rini
  Cc: u-boot

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>
---
 cmd/sysboot.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/cmd/sysboot.c b/cmd/sysboot.c
index 63a7806debe4..d14c570d96ab 100644
--- a/cmd/sysboot.c
+++ b/cmd/sysboot.c
@@ -76,8 +76,12 @@ 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);
 	}
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cmd: sysboot: null check filename
  2024-03-18 23:16 [PATCH] cmd: sysboot: null check filename Caleb Connolly
@ 2024-04-10 17:43 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2024-04-10 17:43 UTC (permalink / raw)
  To: Patrice Chotard, Ramon Fried, Sean Edmond, Caleb Connolly; +Cc: u-boot

On Mon, 18 Mar 2024 23:16:36 +0000, Caleb Connolly wrote:

> 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.
> 
> 

Applied to u-boot/master, thanks!

-- 
Tom



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-10 17:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-18 23:16 [PATCH] cmd: sysboot: null check filename Caleb Connolly
2024-04-10 17:43 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.