Skip to content

Commit 346f737

Browse files
de-nordicnordicjm
authored andcommitted
boot: bootutil: Use BOOT_IMG_AREA to get boot_loader_state area
There have been invocations of BOOT_IMG(...).area used where BOOT_IMG_AREA could be used to obtain the same result. Signed-off-by: Dominik Ermel <[email protected]>
1 parent 7c620b9 commit 346f737

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

boot/bootutil/src/bootutil_priv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ boot_img_num_sectors(const struct boot_loader_state *state, size_t slot)
433433
static inline uint32_t
434434
boot_img_slot_off(struct boot_loader_state *state, size_t slot)
435435
{
436-
return flash_area_get_off(BOOT_IMG(state, slot).area);
436+
return flash_area_get_off(BOOT_IMG_AREA(state, slot));
437437
}
438438

439439
#ifndef MCUBOOT_USE_FLASH_AREA_GET_SECTORS

boot/bootutil/src/loader.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2218,15 +2218,15 @@ check_downgrade_prevention(struct boot_loader_state *state)
22182218
if (MCUBOOT_DOWNGRADE_PREVENTION_SECURITY_COUNTER) {
22192219
/* If there was security no counter in slot 0, allow swap */
22202220
rc = bootutil_get_img_security_cnt(state, BOOT_PRIMARY_SLOT,
2221-
BOOT_IMG(state, 0).area,
2221+
BOOT_IMG_AREA(state, 0),
22222222
&security_counter[0]);
22232223
if (rc != 0) {
22242224
return 0;
22252225
}
22262226
/* If there is no security counter in slot 1, or it's lower than
22272227
* that of slot 0, prevent downgrade */
22282228
rc = bootutil_get_img_security_cnt(state, BOOT_SECONDARY_SLOT,
2229-
BOOT_IMG(state, 1).area,
2229+
BOOT_IMG_AREA(state, 1),
22302230
&security_counter[1]);
22312231
if (rc != 0 || security_counter[0] > security_counter[1]) {
22322232
rc = -1;
@@ -2239,8 +2239,8 @@ check_downgrade_prevention(struct boot_loader_state *state)
22392239
if (rc < 0) {
22402240
/* Image in slot 0 prevents downgrade, delete image in slot 1 */
22412241
BOOT_LOG_INF("Image %d in slot 1 erased due to downgrade prevention", BOOT_CURR_IMG(state));
2242-
flash_area_erase(BOOT_IMG(state, 1).area, 0,
2243-
flash_area_get_size(BOOT_IMG(state, 1).area));
2242+
flash_area_erase(BOOT_IMG_AREA(state, 1), 0,
2243+
flash_area_get_size(BOOT_IMG_AREA(state, 1)));
22442244
} else {
22452245
rc = 0;
22462246
}

0 commit comments

Comments
 (0)