aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri John Ledkov <xnox@ubuntu.com>2021-04-21 12:42:01 +0100
committerRamon Fried <rfried.dev@gmail.com>2021-06-18 11:29:17 +0300
commit75efe7dc996ddb9835590b1a8970f19b5c4b1ade (patch)
tree04c108a4eb6cb40360d8c608507ff6f37dc7e0be
parent82a3c9ef20d43d97416589854b4bbcb4c2450c24 (diff)
downloadu-boot-75efe7dc996ddb9835590b1a8970f19b5c4b1ade.zip
u-boot-75efe7dc996ddb9835590b1a8970f19b5c4b1ade.tar.gz
u-boot-75efe7dc996ddb9835590b1a8970f19b5c4b1ade.tar.bz2
cmd: pxe_utils: sysboot: fix crash if either board or soc are not set.
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> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
-rw-r--r--cmd/pxe_utils.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/cmd/pxe_utils.c b/cmd/pxe_utils.c
index 71c5af4..9a30629 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);