From 1aa9e96bff9768ffa2dec09f54fa7f033de38315 Mon Sep 17 00:00:00 2001 From: Mateusz Michalek Date: Fri, 26 Sep 2025 11:51:06 +0200 Subject: [PATCH] [nrf fromtree] boot: bootutil: write_sz fix fixes missing array bug. Signed-off-by: Mateusz Michalek (cherry picked from commit 5e1be19fbc2afde8f7a6eb2ad8e3b31e5c3921cd) --- boot/bootutil/src/bootutil_priv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boot/bootutil/src/bootutil_priv.h b/boot/bootutil/src/bootutil_priv.h index b97825ed4..784baf7e7 100644 --- a/boot/bootutil/src/bootutil_priv.h +++ b/boot/bootutil/src/bootutil_priv.h @@ -253,7 +253,7 @@ struct boot_loader_state { #endif uint8_t swap_type[BOOT_IMAGE_NUMBER]; - uint32_t write_sz; + uint32_t write_sz[BOOT_IMAGE_NUMBER]; #if defined(MCUBOOT_SWAP_USING_OFFSET) uint32_t secondary_offset[BOOT_IMAGE_NUMBER]; @@ -480,7 +480,7 @@ static inline bool boot_u16_safe_add(uint16_t *dest, uint16_t a, uint16_t b) #endif #define BOOT_IMG(state, slot) ((state)->imgs[BOOT_CURR_IMG(state)][(slot)]) #define BOOT_IMG_AREA(state, slot) (BOOT_IMG(state, slot).area) -#define BOOT_WRITE_SZ(state) ((state)->write_sz) +#define BOOT_WRITE_SZ(state) ((state)->write_sz[BOOT_CURR_IMG(state)]) #define BOOT_SWAP_TYPE(state) ((state)->swap_type[BOOT_CURR_IMG(state)]) #define BOOT_TLV_OFF(hdr) ((hdr)->ih_hdr_size + (hdr)->ih_img_size)