All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cmd: pxe_utils: sysboot: fix crash if either board or soc are not set.
@ 2021-04-21 11:42 Dimitri John Ledkov
  2021-05-04 10:25 ` Dimitri John Ledkov
  2021-05-08  6:23 ` Ramon Fried
  0 siblings, 2 replies; 5+ messages in thread
From: Dimitri John Ledkov @ 2021-04-21 11:42 UTC (permalink / raw)
  To: u-boot

If the environment does not have "soc" or "board" set, and fdtdir
option is specified in extlinux.conf, the bootloader will crash whilst
dereferencing a null pointer. Add a guard against null soc or
board. Fixes a crash of qemu-riscv64_smode configuration, which does
not have CONFIG_SYS_SOC defined.

Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com>
---
 cmd/pxe_utils.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/cmd/pxe_utils.c b/cmd/pxe_utils.c
index 71c5af4c25..9a30629e26 100644
--- a/cmd/pxe_utils.c
+++ b/cmd/pxe_utils.c
@@ -587,6 +587,14 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label)
 				f2 = "-";
 				f3 = env_get("board");
 				f4 = ".dtb";
+				if (!f1) {
+					f1 = "";
+					f2 = "";
+				}
+				if (!f3) {
+					f2 = "";
+					f3 = "";
+				}
 			}
 
 			len = strlen(label->fdtdir);
-- 
2.27.0

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

end of thread, other threads:[~2021-06-18  8:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21 11:42 [PATCH] cmd: pxe_utils: sysboot: fix crash if either board or soc are not set Dimitri John Ledkov
2021-05-04 10:25 ` Dimitri John Ledkov
2021-05-08  6:23 ` Ramon Fried
2021-06-15 16:14   ` Dimitri John Ledkov
2021-06-18  8:25     ` Ramon Fried

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.