[PATCH 1/2] efi_loader: use original image_index for FMP versioning
Heinrich Schuchardt
xypron.glpk at gmx.de
Sat Dec 9 15:51:13 CET 2023
On 11/14/23 10:25, Masahisa Kojima wrote:
> FMP versioning uses the image_index argument of
> EFI_FIRMWARE_MANAGEMENT_PROTOCOL.SetImage() service.
> When CONFIG_FWU_MULTI_BANK_UPDATE is enabled, image_index
> is updated by fwu_get_image_index() function. This commit
> saves the original image_index argument and use it for
> FMP versioning.
Why should we call fwu_get_image_index() here if we don't use the new
value? Maybe the call should be placed somewhere else?
Should the call really be needed here, please add a new local variable
inside the if block and add a comment describing why the call is needed.
Best regards
Heinrich
>
> Signed-off-by: Masahisa Kojima <masahisa.kojima at linaro.org>
> ---
> lib/efi_loader/efi_firmware.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
> index 9abb29f1df..9c1a273926 100644
> --- a/lib/efi_loader/efi_firmware.c
> +++ b/lib/efi_loader/efi_firmware.c
> @@ -612,6 +612,8 @@ efi_status_t EFIAPI efi_firmware_raw_set_image(
> {
> int ret;
> efi_status_t status;
> + u8 original_image_index = image_index;
> +
> struct fmp_state state = { 0 };
>
> EFI_ENTRY("%p %d %p %zu %p %p %p\n", this, image_index, image,
> @@ -641,7 +643,7 @@ efi_status_t EFIAPI efi_firmware_raw_set_image(
> NULL, NULL))
> return EFI_EXIT(EFI_DEVICE_ERROR);
>
> - efi_firmware_set_fmp_state_var(&state, image_index);
> + efi_firmware_set_fmp_state_var(&state, original_image_index);
>
> return EFI_EXIT(EFI_SUCCESS);
> }
More information about the U-Boot
mailing list