[PATCH] efi_loader: Fix loaded image alignment

Ilias Apalodimas ilias.apalodimas at linaro.org
Mon Oct 11 15:50:39 CEST 2021


Hi Heinrich,

On Mon, 11 Oct 2021 at 16:45, Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
>
>
> On 10/11/21 14:10, Ilias Apalodimas wrote:
> > We are ignoring the alignment communicated via the PE/COFF header.
> > Starting 5.10 the Linux kernel will loudly complain about it. For more
> > details look at [1] (in linux kernel).
> >
> > So add a function that can allocate aligned EFI memory and use it for our
> > relocated loaded image.
> >
> > [1] c32ac11da3f83 ("efi/libstub: arm64: Double check image alignment at entry")
> >
> > Signed-off-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> > ---

[...]

> > + */
> > +void *efi_alloc_aligned_pages(u64 len, int memory_type, size_t align)
> > +{
> > +     u64 req_pages = efi_size_in_pages(len);
> > +     u64 true_pages = req_pages + efi_size_in_pages(align) - 1;
> > +     u64 free_pages = 0;
>
> The assigned value is never used. Please, remove the assignment.
>
> > +     u64 aligned_mem;
> > +     efi_status_t r;
> > +     u64 mem;
> > +
>
> Please add a comment:
>
>         /* Align must be a power of two */
>
> I can apply these changes when merging.

Ok the changes seem fine to me.   Wait a few days in case Ard sees
this, so he can verify the changes are what the kernel expects.

Thanks
/Ilias
>
> Otherwise
>
[...]


More information about the U-Boot mailing list