Skip to content
Commit 16472e08 authored by Thomas Altenbach's avatar Thomas Altenbach Committed by Jamie McCrae
Browse files

boot_serial: Initialize a bootloader state for bs_list and bs_set



Until d00b11dc, it was possible to call
bootutil_img_validate with a NULL bootloader state, provided the image
is not encrypted. This was used in boot_serial for bs_list and bs_set.

However, for swap strategies, a valid bootloader state is now needed by
bootutil_max_image_size, invoked from bootutil_img_validate. Therefore,
that change caused a NULL pointer access when calling bs_list or bs_set.

To fix that issue, a valid bootloader state is now initialized and given
to bs_list and bs_set each time bs_list_set is called. This state needs
to be initialized with flash areas and sectors, which are used in
bootutil_max_image_size.

To avoid superfluous memory allocations, the global bootloader state
defined in loader.c is used. This is assuming boot_serial_start and
context_boot_go cannot run concurrently.

Note: This PR has been modified from the upstream commit due to
a merge failure from other changes that are not being brought into
Zephyr 3.7

Signed-off-by: default avatarThomas Altenbach <thomas.altenbach@legrand.com>
(cherry picked from commit f1aa499c)
parent 921ee510
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment