Skip to content

Commit 7c44ed0

Browse files
michalek-nonordicjm
authored andcommitted
[nrf fromtree] boot: bootutil: write_sz fix
fixes missing array bug. Signed-off-by: Mateusz Michalek <[email protected]> (cherry picked from commit 5e1be19fbc2afde8f7a6eb2ad8e3b31e5c3921cd)
1 parent 8534953 commit 7c44ed0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

boot/bootutil/src/bootutil_priv.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ struct boot_loader_state {
253253
#endif
254254

255255
uint8_t swap_type[BOOT_IMAGE_NUMBER];
256-
uint32_t write_sz;
256+
uint32_t write_sz[BOOT_IMAGE_NUMBER];
257257

258258
#if defined(MCUBOOT_SWAP_USING_OFFSET)
259259
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)
480480
#endif
481481
#define BOOT_IMG(state, slot) ((state)->imgs[BOOT_CURR_IMG(state)][(slot)])
482482
#define BOOT_IMG_AREA(state, slot) (BOOT_IMG(state, slot).area)
483-
#define BOOT_WRITE_SZ(state) ((state)->write_sz)
483+
#define BOOT_WRITE_SZ(state) ((state)->write_sz[BOOT_CURR_IMG(state)])
484484
#define BOOT_SWAP_TYPE(state) ((state)->swap_type[BOOT_CURR_IMG(state)])
485485
#define BOOT_TLV_OFF(hdr) ((hdr)->ih_hdr_size + (hdr)->ih_img_size)
486486

0 commit comments

Comments
 (0)