[PATCH v5 1/7] arm: mach-k3: Explicitly identify TIFSSTUB images when discarding buffers
Beleswar Padhi <[email protected]> Mon, 20 Jul 2026 13:31:08 +0530
| Newsgroups | de.denx.lists.u-boot |
|---|---|
| Message-ID | <[email protected]> |
The board_fit_image_post_process() function assumes that all TIFSSTUB images appear at the end of the image_os_match[] array by using the condition: i < IMAGE_AMT && i > IMAGE_ID_DM_FW However, this assumption breaks when new image types are appended to the enum and the array, causing unintended image types to match this condition and having their buffer sizes incorrectly set to 0 with: *p_size = 0 To avoid this issue, replace the range-based check with an explicit match for TIFSSTUB image IDs. Signed-off-by: Beleswar Padhi <[email protected]> Reviewed-by: Neha Malcom Francis <[email protected]> Reviewed-by: Simon Glass <[email protected]> --- v5: Changelog: 1. Add R/B tags. Link to v4: https://lore.kernel.org/all/[email protected]/ v4: Changelog: 1. Added the correct condition in commit message. [Andrew] Link to v3: https://lore.kernel.org/all/[email protected]/ v3: Changelog: 1. None Link to v2: https://lore.kernel.org/all/[email protected]/ v2: Changelog: 1. New patch. Fixes condition to allow new images to be added at the end of the enum. arch/arm/mach-k3/r5/common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-k3/r5/common.c b/arch/arm/mach-k3/r5/common.c index 484d96f9536..a0e1b791c82 100644 --- a/arch/arm/mach-k3/r5/common.c +++ b/arch/arm/mach-k3/r5/common.c @@ -347,7 +347,8 @@ void board_fit_image_post_process(const void *fit, int node, void **p_image, } } - if (i < IMAGE_AMT && i > IMAGE_ID_DM_FW) { + if (i == IMAGE_ID_TIFSSTUB_HS || i == IMAGE_ID_TIFSSTUB_FS || + i == IMAGE_ID_TIFSSTUB_GP) { int device_type = get_device_type(); if ((device_type == K3_DEVICE_TYPE_HS_SE && -- 2.34.1