spl: Check the return of the /fit-images entry/load lookup
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 2 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | spl: atf: Check the return of the entry/load lookupcommon/ | +12 | 2 replies | |
| 2/2 | spl: opensbi: Check the return of the entry/load lookupcommon/ | +5 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/2] spl: Check the return of the /fit-images entry/load lookup
Both the ATF and the OpenSBI hand-off paths look up the next stage's entry point in a /fit-images node, trying fit_image_get_entry() and falling back to fit_image_get_load(). Neither site tests the result of the fallback.
fit_image_get_address() returns -1 before it reaches the assignment to *load in two cases: the property is absent, and the value does not fit in a target ulong. The caller's ulong is left untouched in both, so a node with neither property leaves the entry point uninitialised. It reaches bl31_entry() as the BL33 entry point on ARM, and opensbi_info.next_addr, the S-mode entry point, on RISC-V.
Both sites came from the same conversion in commit caa7fc2c5775 ("spl: Use standard FIT entries"). fdt_getprop_u32() returned the value and yielded FDT_ERROR on failure, so the variable was always assigned; the fit_image_get_*() accessors moved the failure signal into a return value that was then ignored.
Build-tested with no new warnings:
sifive_unmatched_defconfig (riscv64, spl/u-boot-spl)
cm3588-nas-rk3588_defconfig (aarch64, spl/u-boot-spl, covers spl_atf.c)
Sebastian Alba Vives (2):
spl: atf: Check the return of the entry/load lookup
spl: opensbi: Check the return of the entry/load lookup
common/spl/spl_atf.c | 20 ++++++++++++-------- common/spl/spl_opensbi.c | 5 +++++ 2 files changed, 17 insertions(+), 8 deletions(-)
Signature · 1 line
2.43.0