All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Bin Meng <bmeng.cn@gmail.com>,
	 Christian Gmeiner <christian.gmeiner@gmail.com>,
	U-Boot Mailing List <u-boot@lists.denx.de>
Subject: Re: [PATCH] smbios: Fix SMBIOS tables
Date: Sat, 26 Jun 2021 12:30:01 -0600	[thread overview]
Message-ID: <CAPnjgZ2P+fz5_ZUwjaUO3wT8VW1qkpcvsCLU8METT=ghZTg2aA@mail.gmail.com> (raw)
In-Reply-To: <20210610093316.833557-1-ilias.apalodimas@linaro.org>

Hi Ilias,

On Thu, 10 Jun 2021 at 03:33, Ilias Apalodimas
<ilias.apalodimas@linaro.org> wrote:
>
> Commit e4f8e543f1a9("smbios: Drop the unused Kconfig options")
> break SMBIOS tables.  The reason is that the patch drops the Kconfig
> options *after* removing the code using them,  but that changes the semantics
> of the code completely.  Prior to the change a non NULL value was used in
> the 'product' and 'manufacturer ' fields.
>
> Chapter 6.2 of the DMTF spec requires Manufacturer and Product Name to be
> non-null on some of the tables. So let's add sane defaults for Type1/2/3.
>
> * Before the patchset:
>
> <snip>
> Handle 0x0002, DMI type 2, 14 bytes
> Base Board Information
>         Manufacturer: Not Specified
>         Product Name: Not Specified
>         Version: Not Specified
>         Serial Number: Not Specified
>         Asset Tag: Not Specified
>         Features:
>                 Board is a hosting board
>         Location In Chassis: Not Specified
>         Chassis Handle: 0x0000
>         Type: Motherboard
>
> Invalid entry length (0). DMI table is broken! Stop.
>
> * After the patchset:
>
> <snip>
> Handle 0x0005, DMI type 32, 11 bytes
> System Boot Information
>         Status: No errors detected
>
> Handle 0x0006, DMI type 127, 4 bytes
> End Of Table
>
> Fixes: e4f8e543f1a9 ("smbios: Drop the unused Kconfig options")
> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> ---
> This depends on https://lists.denx.de/pipermail/u-boot/2021-June/451761.html
>  lib/smbios.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)

It is strange that all the boards that defined the old CONFIG set it
to "", meaning that an empty string is used. Was that just wrong?

In your patch you are using 'Unknown' and 'Unknown Product'. Should it
use CONFIG_SYS_VENDOR and CONFIG_SYS_BOARD instead?

Or should we actually fail (and return an error code), and require the
properties to be set by the board? It does not seem very useful to
have a meaningless string. Are these SMBIOS values ignored in Linux?

>
> diff --git a/lib/smbios.c b/lib/smbios.c
> index abdd157a7084..e2c6b1a44ee3 100644
> --- a/lib/smbios.c
> +++ b/lib/smbios.c
> @@ -259,7 +259,11 @@ static int smbios_write_type1(ulong *current, int handle,
>         fill_smbios_header(t, SMBIOS_SYSTEM_INFORMATION, len, handle);
>         smbios_set_eos(ctx, t->eos);
>         t->manufacturer = smbios_add_prop(ctx, "manufacturer");
> +       if (!t->manufacturer)
> +               t->manufacturer = smbios_add_string(ctx, "Unknown");
>         t->product_name = smbios_add_prop(ctx, "product");
> +       if (!t->product_name)
> +               t->product_name = smbios_add_string(ctx, "Unknown Product");
>         t->version = smbios_add_prop_si(ctx, "version",
>                                         SYSINFO_ID_SMBIOS_SYSTEM_VERSION);
>         if (serial_str) {
> @@ -289,7 +293,11 @@ static int smbios_write_type2(ulong *current, int handle,
>         fill_smbios_header(t, SMBIOS_BOARD_INFORMATION, len, handle);
>         smbios_set_eos(ctx, t->eos);
>         t->manufacturer = smbios_add_prop(ctx, "manufacturer");
> +       if (!t->manufacturer)
> +               t->manufacturer = smbios_add_string(ctx, "Unknown");
>         t->product_name = smbios_add_prop(ctx, "product");
> +       if (!t->product_name)
> +               t->product_name = smbios_add_string(ctx, "Unknown Product");
>         t->version = smbios_add_prop_si(ctx, "version",
>                                         SYSINFO_ID_SMBIOS_BASEBOARD_VERSION);
>         t->asset_tag_number = smbios_add_prop(ctx, "asset-tag");
> @@ -314,6 +322,8 @@ static int smbios_write_type3(ulong *current, int handle,
>         fill_smbios_header(t, SMBIOS_SYSTEM_ENCLOSURE, len, handle);
>         smbios_set_eos(ctx, t->eos);
>         t->manufacturer = smbios_add_prop(ctx, "manufacturer");
> +       if (!t->manufacturer)
> +               t->manufacturer = smbios_add_string(ctx, "Unknown");
>         t->chassis_type = SMBIOS_ENCLOSURE_DESKTOP;
>         t->bootup_state = SMBIOS_STATE_SAFE;
>         t->power_supply_state = SMBIOS_STATE_SAFE;
> --
> 2.32.0.rc0
>

Regrads,
Simon

  parent reply	other threads:[~2021-06-26 18:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10  9:33 [PATCH] smbios: Fix SMBIOS tables Ilias Apalodimas
2021-06-10  9:55 ` Heinrich Schuchardt
2021-06-26 18:30 ` Simon Glass [this message]
2021-06-26 18:51   ` Ilias Apalodimas
2021-06-27 19:32     ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPnjgZ2P+fz5_ZUwjaUO3wT8VW1qkpcvsCLU8METT=ghZTg2aA@mail.gmail.com' \
    --to=sjg@chromium.org \
    --cc=bmeng.cn@gmail.com \
    --cc=christian.gmeiner@gmail.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.