From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A7D2C47094 for ; Thu, 10 Jun 2021 09:55:56 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2488861403 for ; Thu, 10 Jun 2021 09:55:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2488861403 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmx.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EE2C582D15; Thu, 10 Jun 2021 11:55:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="TZOKwjI9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 38BE382D15; Thu, 10 Jun 2021 11:55:51 +0200 (CEST) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CCA8282EBB for ; Thu, 10 Jun 2021 11:55:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1623318946; bh=E7BC4NlX9Uiyx7z91AEIoLQi/0dZ0NFiwJxRueeFV2Y=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=TZOKwjI9y7HgB8guXkAQW7Qs2zNakO3jQADOuqSaktMLGh3boyjdtmi1uAPHxmrZI zrVZUWbfnsGdzeuTfZX0l8CtA/vKrVeeAVmyKDA3CmtuwhLT0pjBg30G6F65H0xaUV 7XAdVp5LPYkvAByBahmaxeFkUKyhqSvUfyw0DnB0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.123.35] ([62.143.247.63]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M6llE-1lzYsu1bAc-008KmT; Thu, 10 Jun 2021 11:55:46 +0200 Subject: Re: [PATCH] smbios: Fix SMBIOS tables To: Ilias Apalodimas , Simon Glass Cc: Bin Meng , Christian Gmeiner , u-boot@lists.denx.de References: <20210610093316.833557-1-ilias.apalodimas@linaro.org> From: Heinrich Schuchardt Message-ID: <9cff254f-7dc8-44d8-be27-e0f5c0284968@gmx.de> Date: Thu, 10 Jun 2021 11:55:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <20210610093316.833557-1-ilias.apalodimas@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:H743jo9j1857v+tEcvRJHQz5rxN1+dmwS4+Fl/qMUZcqDfa7SoY Si1ydrTXa7ftWUF49ff/GDDdlKgoVYuDYKUaT3lzEI96eTDlbFgB6R8fe/98w5U4FHir2po d6/9am4wLycKheR33xSEGXA3prsub2d55plCUMDP3UxZY2uzAw4q/nDjfz+fCMLfPBsvOqg ObKR0Hby9sVFL8RDbR/9g== X-UI-Out-Filterresults: notjunk:1;V03:K0:eXhYuPtWTII=:rv1BjIhWLKPYJ2197sQPPU 5jEFljGjSVx5j5F4WQ9SNyrp38y1uyZeZ45XWrKQP2phKwx3Ds5FXNBvJz1Z1zqU82L032bjq R1GuFpYVben1grkoTcO32hTxfh9xaFiG5GZgtejvv3OhorP/sjmHvrVDpmH7Wuu+cAJd5HqTT bm4Js9hNBa0fotsc9ajNUzKNqLxiAWEgqfRlDy4d9ch8okqYPm/phKEebFXpAcXTe4EXZ/M3h wqINN3Hj7VkcCcg3oVZvP3T3lnu66IPr1RBAZw391RhOShFYY5Z0M5IcmFqd1I4I5T+Mh4YSW rwPtoh/nOwyGWhTC9KONSuk80BxEFowjXUNeMsIMChJ/Q7QnT9I2j1VQUOPpfd95HT6FYXIo3 wI+kejhAsnFnHSrk/RC0AFEZjj+0dutj95sOWpfdwRetX1SRYBZU1cnYJLfg/io2at+Vsi8Iy yutwgo6K0rPHFNzl9T7GTjeCEp7P8y4T4XDjKFl7lWhuYg8Azbm28DHyilb16IugCeQEEM6fO 8+qnmSbMbifbzta3mRkn2NGjqBwjZMvRoeGq4/NITlKAEmucjexqe+u0wZkaxI6XQsZpGlZS5 SZg4Wnl8C+C/MZPlVnHgZteooqsqWgZgVnG77x065oX9rZmm9X1526naDZRB66cnEW/znkEGG 6qz70loRDDnsYD9WvMD80Ho+2lB0/wxJCN/ke1Tpa8FyVH2u+GaKkH3UXuwbjZxdH/pQu28GV oLE4ZAJ9LQxW/vbJIJabKA7k5BFUccGlyyuOQ3rWz2zf236ImsMG98o+VA6txdSf9A7EuMxgY eVBPfPdkh82hs3sCdEYUulDI9PEXj1CPSEsfF0lxuOc/NhL//q6QyKG0hoj7wo1Eh0rfe49hi p/nrYjFIaBWBOIdzo4k/tLrThSsvkG5wsGzypLr3aNqCTsZqzFtKAMCBatZf+PxxRFIaBVasG 5Zgbu4LDbqUFNQ+mqr0pJ2HTSApHe5XAkm+7KCpGG01RV2r1PUFlxOivKFdEsmbpS1xhdgiDT vH6cPGAmsOkzJGiOilFSkVkoVtCax8Sk8aGDdo0KXn9LjTKce3f+UGRyhuCZLDpldxPq/odW5 eaUQ1xGIeByUldu/QtbOAdHKVFGS94WaNdZ X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean On 6/10/21 11:33 AM, Ilias Apalodimas 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 sema= ntics > of the code completely. Prior to the change a non NULL value was used i= n > the 'product' and 'manufacturer ' fields. > > Chapter 6.2 of the DMTF spec requires Manufacturer and Product Name to b= e > non-null on some of the tables. So let's add sane defaults for Type1/2/3= . > > * Before the patchset: @Ilias, Simon: Simon should take this patch as he has been the main contributor for SMBIO= S. Acked-by: Heinrich Schuchardt > > > 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: > > > 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 > --- > This depends on https://lists.denx.de/pipermail/u-boot/2021-June/451761.= html > lib/smbios.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > 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 h= andle, > fill_smbios_header(t, SMBIOS_SYSTEM_INFORMATION, len, handle); > smbios_set_eos(ctx, t->eos); > t->manufacturer =3D smbios_add_prop(ctx, "manufacturer"); > + if (!t->manufacturer) > + t->manufacturer =3D smbios_add_string(ctx, "Unknown"); > t->product_name =3D smbios_add_prop(ctx, "product"); > + if (!t->product_name) > + t->product_name =3D smbios_add_string(ctx, "Unknown Product"); > t->version =3D 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 h= andle, > fill_smbios_header(t, SMBIOS_BOARD_INFORMATION, len, handle); > smbios_set_eos(ctx, t->eos); > t->manufacturer =3D smbios_add_prop(ctx, "manufacturer"); > + if (!t->manufacturer) > + t->manufacturer =3D smbios_add_string(ctx, "Unknown"); > t->product_name =3D smbios_add_prop(ctx, "product"); > + if (!t->product_name) > + t->product_name =3D smbios_add_string(ctx, "Unknown Product"); > t->version =3D smbios_add_prop_si(ctx, "version", > SYSINFO_ID_SMBIOS_BASEBOARD_VERSION); > t->asset_tag_number =3D smbios_add_prop(ctx, "asset-tag"); > @@ -314,6 +322,8 @@ static int smbios_write_type3(ulong *current, int ha= ndle, > fill_smbios_header(t, SMBIOS_SYSTEM_ENCLOSURE, len, handle); > smbios_set_eos(ctx, t->eos); > t->manufacturer =3D smbios_add_prop(ctx, "manufacturer"); > + if (!t->manufacturer) > + t->manufacturer =3D smbios_add_string(ctx, "Unknown"); > t->chassis_type =3D SMBIOS_ENCLOSURE_DESKTOP; > t->bootup_state =3D SMBIOS_STATE_SAFE; > t->power_supply_state =3D SMBIOS_STATE_SAFE; >