Skip to content

Commit 56aad51

Browse files
committed
bootutil: swap_scratch: Fix scratch scrambling
This commit fixes the scrambling of the scratch area after persisting a trailer to the primary slot. Previous use of boot_erase_region() didn't guarantee that the scratch area is scrambled, as it only erases memory for devices that selects CONFIG_MCUBOOT_STORAGE_WITH_ERASE. Signed-off-by: Michal Kozikowski <[email protected]>
1 parent 16cfdaf commit 56aad51

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

boot/bootutil/src/swap_scratch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ boot_swap_sectors(int idx, uint32_t sz, struct boot_loader_state *state,
913913
* happens then the scratch which is partially erased would be wrote back to the
914914
* primary slot, causing a corrupt unbootable image
915915
*/
916-
rc = boot_erase_region(fap_scratch, 0, flash_area_get_size(fap_scratch), true);
916+
rc = boot_scramble_region(fap_scratch, 0, flash_area_get_size(fap_scratch), true);
917917
assert(rc == 0);
918918
}
919919
}

0 commit comments

Comments
 (0)