]> git.ipfire.org Git - thirdparty/u-boot.git/commit
qcom: board: validate fdt before trying to use it
authorVolodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Mon, 11 Mar 2024 21:33:45 +0000 (21:33 +0000)
committerCaleb Connolly <caleb.connolly@linaro.org>
Thu, 4 Apr 2024 15:46:45 +0000 (17:46 +0200)
commit86eb5d834d220893b5dc262c5aea7f933e275a4f
treec6418137c8233764411653643bf8a655044cc28f
parentb621dcd16246d5271ae000701c50b2deaac3feab
qcom: board: validate fdt before trying to use it

There are cases when previous bootloader stage leaves some seemingly
valid value in r0, which in fact does not point to valid FDT
blob. This behavior was encountered when trying to boot U-Boot as
"hyp" loader on SA8155P-ADP.

To be sure that we really got the pointer to a device tree we need to
validate it with fdt_check_header() function.

Note: This approach is not 100% fool-proof, as get_prev_bl_fdt_addr()
theoretically can return a pointer to a region that is not physically
mapped and we will get data abort exception when fdt_check_header()
will try to access it. But at this early boot stage we don't know
where RAM is anyways so there is little we can do.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
arch/arm/mach-snapdragon/board.c