Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions boot/bootutil/src/swap_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ swap_status_init(const struct boot_loader_state *state,

BOOT_LOG_DBG("initializing status; fa_id=%d", flash_area_get_id(fap));

memset(&swap_state, 0, sizeof(struct boot_swap_state));
rc = boot_read_swap_state(state->imgs[image_index][BOOT_SLOT_SECONDARY].area,
&swap_state);
assert(rc == 0);
Expand Down
3 changes: 3 additions & 0 deletions boot/bootutil/src/swap_move.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ swap_status_source(struct boot_loader_state *state)
#endif

image_index = BOOT_CURR_IMG(state);
memset(&state_primary_slot, 0, sizeof(struct boot_swap_state));
memset(&state_secondary_slot, 0, sizeof(struct boot_swap_state));

rc = boot_read_swap_state(state->imgs[image_index][BOOT_SLOT_PRIMARY].area,
&state_primary_slot);
Expand Down Expand Up @@ -464,6 +466,7 @@ fixup_revert(const struct boot_loader_state *state, struct boot_status *bs,
return;
}

memset(&swap_state, 0, sizeof(struct boot_swap_state));
rc = boot_read_swap_state(fap_sec, &swap_state);
assert(rc == 0);

Expand Down
3 changes: 3 additions & 0 deletions boot/bootutil/src/swap_offset.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,8 @@ int swap_status_source(struct boot_loader_state *state)
(void)state;
#endif

memset(&state_primary_slot, 0, sizeof(struct boot_swap_state));
memset(&state_secondary_slot, 0, sizeof(struct boot_swap_state));
image_index = BOOT_CURR_IMG(state);
rc = boot_read_swap_state(state->imgs[image_index][BOOT_SLOT_PRIMARY].area,
&state_primary_slot);
Expand Down Expand Up @@ -562,6 +564,7 @@ void fixup_revert(const struct boot_loader_state *state, struct boot_status *bs,
return;
}

memset(&swap_state, 0, sizeof(struct boot_swap_state));
rc = boot_read_swap_state(fap_sec, &swap_state);
assert(rc == 0);

Expand Down
6 changes: 6 additions & 0 deletions boot/bootutil/src/swap_scratch.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,11 @@ swap_status_source(struct boot_loader_state *state)
(void)state;
#endif

memset(&state_primary_slot, 0, sizeof(struct boot_swap_state));
#if MCUBOOT_SWAP_USING_SCRATCH
memset(&state_scratch, 0, sizeof(struct boot_swap_state));
#endif

image_index = BOOT_CURR_IMG(state);
rc = boot_read_swap_state(state->imgs[image_index][BOOT_SLOT_PRIMARY].area,
&state_primary_slot);
Expand Down Expand Up @@ -866,6 +871,7 @@ boot_swap_sectors(int idx, uint32_t sz, struct boot_loader_state *state,
(BOOT_STATUS_STATE_COUNT - 1) * BOOT_WRITE_SZ(state));
BOOT_STATUS_ASSERT(rc == 0);

memset(&swap_state, 0, sizeof(struct boot_swap_state));
rc = boot_read_swap_state(fap_scratch, &swap_state);
assert(rc == 0);

Expand Down
Loading