Skip to content

Commit dbb5c78

Browse files
committed
bootutil: loader: Add state to boot_is_header_valid() function
Adds the state object to this function so it can be referenced Signed-off-by: Jamie McCrae <[email protected]>
1 parent 6071ceb commit dbb5c78

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

boot/bootutil/src/loader.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -863,10 +863,13 @@ split_image_check(struct image_header *app_hdr,
863863
* within the flash area we are in.
864864
*/
865865
static bool
866-
boot_is_header_valid(const struct image_header *hdr, const struct flash_area *fap)
866+
boot_is_header_valid(const struct image_header *hdr, const struct flash_area *fap,
867+
struct boot_loader_state *state)
867868
{
868869
uint32_t size;
869870

871+
(void)state;
872+
870873
if (hdr->ih_magic != IMAGE_MAGIC) {
871874
return false;
872875
}
@@ -1033,7 +1036,7 @@ boot_validate_slot(struct boot_loader_state *state, int slot,
10331036
{
10341037
FIH_CALL(boot_image_check, fih_rc, state, hdr, fap, bs);
10351038
}
1036-
if (!boot_is_header_valid(hdr, fap) || FIH_NOT_EQ(fih_rc, FIH_SUCCESS)) {
1039+
if (!boot_is_header_valid(hdr, fap, state) || FIH_NOT_EQ(fih_rc, FIH_SUCCESS)) {
10371040
if ((slot != BOOT_PRIMARY_SLOT) || ARE_SLOTS_EQUIVALENT()) {
10381041
flash_area_erase(fap, 0, flash_area_get_size(fap));
10391042
/* Image is invalid, erase it to prevent further unnecessary
@@ -2556,7 +2559,7 @@ boot_get_slot_usage(struct boot_loader_state *state)
25562559
for (slot = 0; slot < BOOT_NUM_SLOTS; slot++) {
25572560
hdr = boot_img_hdr(state, slot);
25582561

2559-
if (boot_is_header_valid(hdr, BOOT_IMG_AREA(state, slot))) {
2562+
if (boot_is_header_valid(hdr, BOOT_IMG_AREA(state, slot), state)) {
25602563
state->slot_usage[BOOT_CURR_IMG(state)].slot_available[slot] = true;
25612564
BOOT_LOG_IMAGE_INFO(slot, hdr);
25622565
} else {

0 commit comments

Comments
 (0)