]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
starfive: avoid NULL dereference in fdt_check_header()
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Thu, 28 Aug 2025 13:03:35 +0000 (15:03 +0200)
committerLeo Yu-Chi Liang <ycliang@andestech.com>
Fri, 19 Sep 2025 11:11:18 +0000 (19:11 +0800)
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>
board/starfive/visionfive2/spl.c

index 3dfa931b6556aac6c4209239ec236c879627e98f..fe14b44ce28f1f268390ae1feda218fc3bb8bb77 100644 (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)