Skip to content

Commit

Permalink
fix parentheses
Browse files Browse the repository at this point in the history
  • Loading branch information
jpbland1 committed Jul 10, 2024
1 parent 6fb1230 commit dcd05fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/libwolfboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ uint16_t wolfBoot_find_header(uint8_t *haystack, uint16_t type, uint8_t **ptr)
break;
}
/* Sanity check to prevent dereferencing unaligned half-words */
if (*p == HDR_PADDING || (((size_t)p) & 0x01) != 0) {
if ((*p == HDR_PADDING) || ((((size_t)p) & 0x01) != 0)) {
/* Padding byte (skip one position) */
p++;
continue;
Expand Down
8 changes: 4 additions & 4 deletions src/update_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ static int RAMFUNCTION wolfBoot_update(int fallback_allowed)
* header we can't determine the direction by version numbers. instead
* use the update partition state, updating means regular, new means
* reverting */
if (stateRet == 0 && (flag != SECT_FLAG_NEW || cur_v == 0)) {
if ((stateRet == 0) && ((flag != SECT_FLAG_NEW) || (cur_v == 0))) {
resume = 1;
if (st == IMG_STATE_UPDATING) {
inverse = 0;
Expand All @@ -565,7 +565,7 @@ static int RAMFUNCTION wolfBoot_update(int fallback_allowed)
/* If we're dealing with a "ping-pong" fallback that wasn't interrupted
* we need to set to UPDATING, otherwise there's no way to tell the
* original direction of the update once interrupted */
else if (inverse == 0 && fallback_allowed == 1) {
else if ((inverse == 0) && (fallback_allowed == 1)) {
wolfBoot_set_partition_state(PART_UPDATE, IMG_STATE_UPDATING);
}

Expand Down Expand Up @@ -820,12 +820,12 @@ void RAMFUNCTION wolfBoot_start(void)
* to trigger fallback.
*/
if (resumedFinalErase != 0) {
if (bootRet == 0 && bootState == IMG_STATE_TESTING) {
if ((bootRet == 0) && (bootState == IMG_STATE_TESTING)) {
wolfBoot_update(1);
/* Check for new updates in the UPDATE partition or if we were
* interrupted during the flags setting */
}
else if (updateRet == 0 && updateState == IMG_STATE_UPDATING) {
else if ((updateRet == 0) && (updateState == IMG_STATE_UPDATING)) {
/* Check for new updates in the UPDATE partition */
wolfBoot_update(0);
}
Expand Down

0 comments on commit dcd05fd

Please sign in to comment.