Skip to content

Commit 95d384a

Browse files
nordic-mik7rlubos
authored andcommitted
[nrf fromtree] bootutil: 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]> (cherry picked from commit 800868a)
1 parent c72ed15 commit 95d384a

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
@@ -926,7 +926,7 @@ boot_swap_sectors(int idx, uint32_t sz, struct boot_loader_state *state,
926926
* happens then the scratch which is partially erased would be wrote back to the
927927
* primary slot, causing a corrupt unbootable image
928928
*/
929-
rc = boot_erase_region(fap_scratch, 0, flash_area_get_size(fap_scratch), true);
929+
rc = boot_scramble_region(fap_scratch, 0, flash_area_get_size(fap_scratch), true);
930930
assert(rc == 0);
931931
}
932932
}

0 commit comments

Comments
 (0)