[PATCH v2 09/11] boot: fit: share the external-data offset calculation
Simon Glass
sjg at chromium.org
Fri Oct 23 04:37:34 PDT 2026
On 2026-10-21T14:08:59, Daniel Golle <daniel at makrotopia.org> wrote:
> boot: fit: share the external-data offset calculation
>
> fit_image_load_storage() repeats the data-position / data-offset /
> totalsize-alignment sequence that fit_image_get_data() performs, and
> writes the result through an int pointer where the getters expect a u32.
> The copy also omits the range check on the sum, so an offset that the
> embedded path rejects is accepted here.
>
> Extract fit_image_get_ext_data_offset() and call it from both. The
> storage path gains the range check and both agree on one expression for
> the alignment. The signed comparison of the offset and size is
> meaningless once both are u32, so it is dropped in favour of the shared
> range check the helper provides.
>
> Signed-off-by: Daniel Golle <daniel at makrotopia.org>
>
> boot/image-fit.c | 166 ++++++++++++++++++++++++++++++-------------------------
> 1 file changed, 91 insertions(+), 75 deletions(-)
Reviewed-by: Simon Glass <sjg at chromium.org>
More information about the openwrt-devel
mailing list