Re: [PATCH] libfdt: Add FDT alignment check to fdt_check_header()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Wed, Apr 7, 2021 at 10:35 AM Simon Glass <sjg@xxxxxxxxxxxx> wrote:
>
> Hi Rob,
>
> On Wed, 7 Apr 2021 at 07:07, Rob Herring <robh@xxxxxxxxxx> wrote:
> >
> > Only checking the FDT alignment in fdt_ro_probe_() means that
> > fdt_check_header() can pass, but then subsequent API calls fail on
> > alignment checks. Let's add an alignment check to fdt_check_header() so
> > alignment errors are found up front.
> >
> > Cc: Tom Rini <trini@xxxxxxxxxxxx>
> > Cc: Frank Rowand <frowand.list@xxxxxxxxx>
> > Signed-off-by: Rob Herring <robh@xxxxxxxxxx>
> > ---
> > For background, the new alignment check triggered a crash in the
> > linux kernel. Yes, we should fix the error handling, but
> > fdt_check_header() shouldn't tell us the FDT is valid only to fail
> > later on.
> >
> > Maybe we should move the check instead, but fdt_ro_probe_() and
> > fdt_check_header() already have a lot of the same checks.
> >
> >  libfdt/fdt.c | 4 ++++
> >  1 file changed, 4 insertions(+)
>
> At present U-Boot uses a 4-byte alignment, so far as I know, so this
> will break things.

It was the u-boot folks that wanted this in the first place... Look at
the recent commits from Tom and the discussion on the list about them.

> Is this because of the need to align the memory-reservation block?

But yes, the spec does require some sections to be 8-byte aligned
which implies the whole thing has to be.

Rob



[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux