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

Raymond Mao raymond.mao at linaro.org
Fri Dec 22 16:30:27 CET 2023


Hi Ilias,

On Fri, 22 Dec 2023 at 06:12, Ilias Apalodimas <ilias.apalodimas at linaro.org>
wrote:

> 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
>
to_size should be 0 (use the total_size) or a value larger than total_size.
I think I should keep the below line from the function header.
>> - * @to_size: New size for bloblist (must be larger than from_size)
I will refactor this part.


> > +               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