[PATCH v2 2/2] test: boot: imagemap: check the data-size bound on a direct read
Daniel Golle
daniel at makrotopia.org
Sat Nov 28 18:05:13 PST 2026
On Fri, Nov 20, 2026 at 01:11:08PM +0000, Aristo Chen wrote:
> Build a FIT with an external-data ramdisk that has a load address and
> load it through the imagemap storage path with verification on.
>
> The first test declares a data-size of 1 GiB, far more than the free
> memory at the load address, and confirms that fit_image_load() returns
> -EFBIG. It counts how often the mock reader is entered and asserts that
> this is zero, so the oversized image is rejected before any read reaches
> the device rather than after a failed transfer. Without the preceding
> bound the read is attempted and fails with -EIO.
>
> The second test makes sure that the bound does not get in the way of a
> valid image: a ramdisk whose data-size matches its payload is still read
> straight to its load address. The bound refuses a load address inside a
> used LMB region, so the test takes an address that LMB reports as free.
>
> The tests need the FIT loader, which IMAGEMAP does not depend on, so
> they are skipped when FIT is disabled.
>
> Signed-off-by: Aristo Chen <aristo.chen at canonical.com>
> ---
> v2: add imagemap_test_fit_direct_read(), which checks that a valid
> ramdisk with a load address is still read straight to it. The comments
> of imagemap_test_fit_oversize_datasz() no longer refer to
> CONFIG_SYS_BOOTM_LEN; the test itself is unchanged. New subject, was
> "test: boot: imagemap: reject an oversized data-size".
Reviewed-by: Daniel Golle <daniel at makrotopia.org>
More information about the openwrt-devel
mailing list