summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Schuchardt <[email protected]>2025-08-28 15:03:35 +0200
committerLeo Yu-Chi Liang <[email protected]>2025-09-19 19:11:18 +0800
commit686b48af6d6f4e33f10dc707e9a8c8213b682348 (patch)
tree44a5acfe5617b730c57bcf8590d68720bc0dccd8
parent409c73ef6368b07d4dbdf8391a0b9c7682dcf4b4 (diff)
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 <[email protected]> Reviewed-by: E Shattow <[email protected]>
-rw-r--r--board/starfive/visionfive2/spl.c3
1 files changed, 2 insertions, 1 deletions
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)