From 686b48af6d6f4e33f10dc707e9a8c8213b682348 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 28 Aug 2025 15:03:35 +0200 Subject: [PATCH] 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 Reviewed-by: E Shattow --- board/starfive/visionfive2/spl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/board/starfive/visionfive2/spl.c b/board/starfive/visionfive2/spl.c index 3dfa931b655..fe14b44ce28 100644 --- a/board/starfive/visionfive2/spl.c +++ b/board/starfive/visionfive2/spl.c @@ -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) -- 2.47.3