boot: Given up pxe boot if kernel_addr_r is missing

At present we require this environment variable in order to do any
booting. The check for this actually later (the '"malloc fail' message)
but there is a possible NULL access before getting to that point.

Check it immediately after reading.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-08-07 05:12:19 -06:00
parent 6cff8aa606
commit e385bac1b6

View File

@@ -682,6 +682,10 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)
}
kernel_addr = env_get("kernel_addr_r");
if (!kernel_addr) {
printf("No kernel_addr_r available for kernel\n");
return 1;
}
/* for FIT, append the configuration identifier */
if (label->config) {
int len = strlen(kernel_addr) + strlen(label->config) + 1;