Skip to content

Commit edc4229

Browse files
author
Daniel Fedai Larsen
committed
Fix wolfBoot_update_trigger sector calculation
wolfBoot_update_trigger is called to initiate an update on the next boot. It does this by modifying the metadata in the last sector (selecting one of the two if NVM_FLASH_WRITEONCE is defined). There's a check to handle the case where the PART_UPDATE_ENDFLAGS isn't aligned with the WOLFBOOT_SECTOR_SIZE. However, this check was wrong, as the modulo of these two macros is 0 when aligned, so the check should be != 0.
1 parent 7008f68 commit edc4229

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libwolfboot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ void RAMFUNCTION wolfBoot_update_trigger(void)
742742

743743
/* if PART_UPDATE_ENDFLAGS straddles a sector, (all non FLAGS_HOME builds)
744744
* align it to the correct sector */
745-
if (PART_UPDATE_ENDFLAGS % WOLFBOOT_SECTOR_SIZE == 0)
745+
if (PART_UPDATE_ENDFLAGS % WOLFBOOT_SECTOR_SIZE != 0)
746746
lastSector -= WOLFBOOT_SECTOR_SIZE;
747747

748748
/* erase the sector flags */

0 commit comments

Comments
 (0)