[PATCH v2 3/9] bloblist: refactor of bloblist_reloc()

Ilias Apalodimas ilias.apalodimas at linaro.org
Fri Dec 22 12:11:34 CET 2023


Hi Raymond,

On Thu, 21 Dec 2023 at 02:41, Raymond Mao <raymond.mao at linaro.org> wrote:
>
> The current bloblist pointer and size can be retrieved from global
> data, so we don't need to pass them from the function arguments.
> This change also help to remove all external access of gd->bloblist
> outside of bloblist module.
>
> Signed-off-by: Raymond Mao <raymond.mao at linaro.org>
> ---

[...]

>         }
>  }
>
> -void bloblist_reloc(void *to, uint to_size, void *from, uint from_size)
> +void bloblist_reloc(void *to, uint to_size)
>  {
>         struct bloblist_hdr *hdr;
>
> -       memcpy(to, from, from_size);
> +       memcpy(to, gd->bloblist, gd->bloblist->total_size);
>         hdr = to;
> -       hdr->total_size = to_size;
> +       if (to_size < gd->bloblist->total_size)

What's the size of *to? Is it equal to to_size?
Because if to_size can be smaller that gd->bloblist->total_size the
memcpy above is wrong

> +               hdr->total_size = gd->bloblist->total_size;
> +       else
> +               hdr->total_size = to_size;
> +       gd->bloblist = to;
>  }
>
>  int bloblist_init(void)
> diff --git a/common/board_f.c b/common/board_f.c
> index d4d7d01f8f..00b0430889 100644
> --- a/common/board_f.c

[...]

/Ilias


More information about the U-Boot mailing list