Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle case where PART_UPDATE_ENDFLAGS % WOLFBOOT_SECTOR_SIZE == 0 #351

Merged
merged 3 commits into from
Aug 22, 2023

Conversation

jpbland1
Copy link
Contributor

ZD 16472

@jpbland1 jpbland1 requested a review from dgarske August 21, 2023 21:09
@jpbland1 jpbland1 marked this pull request as ready for review August 21, 2023 21:09

/* if PART_UPDATE_ENDFLAGS stradles a sector, (all non FLAGS_HOME builds)
* align it to the correct sector */
if (PART_UPDATE_ENDFLAGS % WOLFBOOT_SECTOR_SIZE == 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

590 -> lastSector = 0x60050000
596 -> lastSector = 0x6004f000```

Looks good. Why did we not see this issue previously? Are we missing some test cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's because nvm_select_fresh_sector defaults to selecting 0 when both sectors are empty and without this PR it was reading the swap sector and then writing to sector 0 so sector 0 had a non-erased byte and was correctly selected the next time around

@@ -589,6 +589,11 @@ void RAMFUNCTION wolfBoot_update_trigger(void)
#if defined(NVM_FLASH_WRITEONCE) || defined(WOLFBOOT_FLAGS_INVERT)
uintptr_t lastSector = PART_UPDATE_ENDFLAGS -
(PART_UPDATE_ENDFLAGS % WOLFBOOT_SECTOR_SIZE);

/* if PART_UPDATE_ENDFLAGS stradles a sector, (all non FLAGS_HOME builds)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be gated on #ifndef FLAGS_HOME?

@dgarske dgarske merged commit ee628f1 into wolfSSL:master Aug 22, 2023
58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants