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. Signed-off-by:Thomas Altenbach <thomas.altenbach@legrand.com>
Loading
Please sign in to comment