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

boot_serial: Fix showing images that are not valid #1732

Merged
merged 1 commit into from
Jul 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions boot/boot_serial/src/boot_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ bs_list(char *buf, int len)
#endif

for (slot = 0; slot < 2; slot++) {
FIH_DECLARE(fih_rc, FIH_FAILURE);
uint8_t tmpbuf[64];

#ifdef MCUBOOT_SERIAL_IMG_GRP_IMAGE_STATE
Expand All @@ -285,8 +286,6 @@ bs_list(char *buf, int len)

if (hdr.ih_magic == IMAGE_MAGIC)
{
FIH_DECLARE(fih_rc, FIH_FAILURE);

BOOT_HOOK_CALL_FIH(boot_image_check_hook,
FIH_BOOT_HOOK_REGULAR,
fih_rc, image_index, slot);
Expand All @@ -306,10 +305,11 @@ bs_list(char *buf, int len)
FIH_CALL(bootutil_img_validate, fih_rc, NULL, 0, &hdr, fap, tmpbuf, sizeof(tmpbuf),
NULL, 0, NULL);
}
}

if (FIH_NOT_EQ(fih_rc, FIH_SUCCESS)) {
continue;
}
if (FIH_NOT_EQ(fih_rc, FIH_SUCCESS)) {
flash_area_close(fap);
continue;
}

#ifdef MCUBOOT_SERIAL_IMG_GRP_HASH
Expand Down Expand Up @@ -354,7 +354,7 @@ bs_list(char *buf, int len)

if (!(hdr.ih_flags & IMAGE_F_NON_BOOTABLE)) {
zcbor_tstr_put_lit_cast(cbor_state, "bootable");
zcbor_bool_put(cbor_state, 1);
zcbor_bool_put(cbor_state, true);
}

if (confirmed) {
Expand Down