All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] spl: Fix the uninitialised /fit-images entry point
@ 2026-10-12 21:46 Sebastian Alba Vives
  2026-10-12 21:46 ` [PATCH v2 1/2] spl: atf: Keep the caller's default when the entry lookup fails Sebastian Alba Vives
  2026-10-12 21:46 ` [PATCH v2 2/2] spl: opensbi: Check the return of the entry/load lookup Sebastian Alba Vives
  0 siblings, 2 replies; 4+ messages in thread
From: Sebastian Alba Vives @ 2026-10-12 21:46 UTC (permalink / raw)
  To: u-boot; +Cc: trini, sjg, michal.simek, Sebastian Alba Vives

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.

The two paths differ in what a failed lookup means, so they are fixed
differently. In spl_invoke_atf() the caller has already initialised a
sane default (0 for BL32, CONFIG_TEXT_BASE for BL33), so the out
parameter is the whole fix and there is no status worth returning. In
spl_invoke_opensbi() there is no default, so the boot fails.

Changes in v2:
 - 1/2: drop the int return type. Tom pointed out that neither call site
   checked it, and there is nothing for them to do: the accessors leave
   the out parameter untouched on failure, so the default the caller
   already set up stands. The function is void and the commit message
   now spells out that mechanism. Subject reworded to match.
 - 2/2: unchanged.

v1: https://lore.kernel.org/u-boot/20261012015542.1156811-1-sebasjosue84@gmail.com/

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: Keep the caller's default when the entry lookup fails
  spl: opensbi: Check the return of the entry/load lookup

 common/spl/spl_atf.c     | 21 ++++++++++++---------
 common/spl/spl_opensbi.c |  5 +++++
 2 files changed, 17 insertions(+), 9 deletions(-)

-- 
2.43.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-13 20:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-12 21:46 [PATCH v2 0/2] spl: Fix the uninitialised /fit-images entry point Sebastian Alba Vives
2026-10-12 21:46 ` [PATCH v2 1/2] spl: atf: Keep the caller's default when the entry lookup fails Sebastian Alba Vives
2026-10-12 21:46 ` [PATCH v2 2/2] spl: opensbi: Check the return of the entry/load lookup Sebastian Alba Vives
2026-10-13 20:17   ` Yao Zi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.