Commit 1d96f36d authored by Hovland, Sigvart's avatar Hovland, Sigvart Committed by Andrzej Puzdrowski
Browse files

Fix the wrong size of array of magic word in bootutil_misc

This will fix #335 by defining the array size of the magic word and
give it to the relevant functions.

Signed-off-by: default avatarHovland, Sigvart <sigvart.hovland@nordicsemi.no>
parent 42ad446f
Loading
Loading
Loading
Loading
+5 −2
Changes for boot/bootutil/src/bootutil_misc.c: 5 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -43,6 +43,9 @@ const uint32_t boot_img_magic[] = {
    0x8079b62c,
};

#define BOOT_MAGIC_ARR_SZ \
    (sizeof boot_img_magic / sizeof boot_img_magic[0])

const uint32_t BOOT_MAGIC_SZ = sizeof boot_img_magic;
const uint32_t BOOT_MAX_ALIGN = MAX_FLASH_ALIGN;

@@ -220,7 +223,7 @@ int
boot_read_swap_state(const struct flash_area *fap,
                     struct boot_swap_state *state)
{
    uint32_t magic[BOOT_MAGIC_SZ];
    uint32_t magic[BOOT_MAGIC_ARR_SZ];
    uint32_t off;
    int rc;

@@ -280,7 +283,7 @@ boot_read_swap_state_by_id(int flash_area_id, struct boot_swap_state *state)
int
boot_read_swap_size(uint32_t *swap_size)
{
    uint32_t magic[BOOT_MAGIC_SZ];
    uint32_t magic[BOOT_MAGIC_ARR_SZ];
    uint32_t off;
    const struct flash_area *fap;
    int rc;