starfive: avoid NULL dereference in fdt_check_header()

If the u-boot.itb read from SD-card is invalid, fdt_check_header() may be
called with a NULL pointer.

This was observed on an StarFive VisionFive Lite when trying to revover the
board via UART.

Add a missing check in the starfive board code.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: E Shattow <e@freeshell.de>
This commit is contained in:
Heinrich Schuchardt
2025-08-28 15:03:35 +02:00
committed by Leo Yu-Chi Liang
parent 409c73ef63
commit 686b48af6d

View File

@@ -23,7 +23,8 @@ DECLARE_GLOBAL_DATA_PTR;
void spl_perform_fixups(struct spl_image_info *spl_image)
{
/* Update the memory size which read from eeprom or DT */
fdt_fixup_memory(spl_image->fdt_addr, 0x40000000, gd->ram_size);
if (spl_image->fdt_addr)
fdt_fixup_memory(spl_image->fdt_addr, 0x40000000, gd->ram_size);
}
static void jh7110_jtag_init(void)