riscv: ae350: Check firmware_fdt_addr header

Check firmware_fdt_addr header to see if it
is a valid fdt blob.

Signed-off-by: Rick Chen <rick@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
This commit is contained in:
Rick Chen 2022-10-20 13:56:17 +08:00 committed by Leo Yu-Chi Liang
parent bdb238355c
commit b3b44c674a

View File

@ -60,7 +60,7 @@ void *board_fdt_blob_setup(int *err)
*err = 0;
if (IS_ENABLED(CONFIG_OF_SEPARATE) || IS_ENABLED(CONFIG_OF_BOARD)) {
if (gd->arch.firmware_fdt_addr)
if (fdt_magic((uintptr_t)gd->arch.firmware_fdt_addr) == FDT_MAGIC)
return (void *)(ulong)gd->arch.firmware_fdt_addr;
}