[PATCH] cmd: pxe_utils: sysboot: fix crash if either board or soc are not set.

Ramon Fried rfried.dev at gmail.com
Sat May 8 08:23:10 CEST 2021


On Wed, Apr 21, 2021 at 5:32 PM Dimitri John Ledkov <xnox at ubuntu.com> wrote:
>
> 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 at 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
>
Reviewed-by: Ramon Fried <rfried.dev at gmail.com>


More information about the U-Boot mailing list