Skip to content

Commit 2f5b764

Browse files
committed
Fix offset updating trailer: swap_and_final_erase
When wolfBoot_swap_and_final_erase() is invoked, it was calculating the wrong offset, ending up erasing the third-last sector of the boot partition. This might cause erasing part of the firmware, eventually causing failed boot.
1 parent 21a4082 commit 2f5b764

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/update_flash.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,7 @@ static int wolfBoot_swap_and_final_erase(int resume)
218218
#endif
219219
);
220220
int swapDone = 0;
221-
uintptr_t tmpBootPos = WOLFBOOT_PARTITION_SIZE - eraseLen -
222-
WOLFBOOT_SECTOR_SIZE;
221+
uintptr_t tmpBootPos = WOLFBOOT_PARTITION_SIZE - eraseLen;
223222
uint32_t tmpBuffer[TRAILER_OFFSET_WORDS + 1];
224223

225224
/* open partitions (ignore failure) */

0 commit comments

Comments
 (0)