[PATCH v2 6/6] smbios: Require the caller to align the SMBIOS table

Ilias Apalodimas ilias.apalodimas at linaro.org
Wed Dec 27 11:53:24 CET 2023


On Tue, 26 Dec 2023 at 14:46, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> On 10/15/23 04:45, Simon Glass wrote:
> > All callers handle this alignment, so drop the unnecessary code. This
> > simplifies things a little.
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
>
> Reviewed: Heinrich Schuchardt <xypron.glpk at gmx.de>
>
> > ---
> >
> > (no changes since v1)
> >
> >   include/smbios.h | 5 +----
> >   lib/smbios.c     | 2 --
> >   2 files changed, 1 insertion(+), 6 deletions(-)
> >
> > diff --git a/include/smbios.h b/include/smbios.h
> > index ddabb558299e..31d997287588 100644
> > --- a/include/smbios.h
> > +++ b/include/smbios.h
> > @@ -248,12 +248,9 @@ static inline void fill_smbios_header(void *table, int type,
> >    *
> >    * This writes SMBIOS table at a given address.
> >    *
> > - * @addr:    start address to write SMBIOS table. If this is not
> > - *           16-byte-aligned then it will be aligned before the table is
> > - *           written.
> > + * @addr:    start address to write SMBIOS table (must be 16-byte-aligned)
> >    * Return:  end address of SMBIOS table (and start address for next entry)
> >    *          or NULL in case of an error
> > - *
> >    */
> >   ulong write_smbios_table(ulong addr);
> >
> > diff --git a/lib/smbios.c b/lib/smbios.c
> > index 92e98388084f..5c9f108496d6 100644
> > --- a/lib/smbios.c
> > +++ b/lib/smbios.c
> > @@ -483,8 +483,6 @@ ulong write_smbios_table(ulong addr)
> >               ctx.dev = NULL;
> >       }
> >
> > -     /* 16 byte align the table address */
> > -     addr = ALIGN(addr, 16);

I don't think this is fine. Failing to do so would break the SMBIOS
tables. It's fine to require this but in that case, we should have add
a check for the 16b alignment

Thanks
/Ilias
> >       start_addr = addr;
> >
> >       /*
>


More information about the U-Boot mailing list