From patchwork Thu Jun 10 09:33:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 457845 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp252178jae; Thu, 10 Jun 2021 02:33:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPteitqkPok32k7AuCtA5OhoG4jFt4vSFAOB6/xjx3BSfczvxtEPfGanPt2ghr9XP1chMg X-Received: by 2002:a17:906:4ad2:: with SMTP id u18mr3446343ejt.197.1623317610718; Thu, 10 Jun 2021 02:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623317610; cv=none; d=google.com; s=arc-20160816; b=cCbIXeyvUnw5El7btZNLmkjolp4KE0KShehdTrixUktodmPehOJCfoHiPpkLHzNBtc 77qyskOxleKrVoyChL3YOC4myvnx1KeaNQzEJZE91fOwpTZEpV3KijkSUDo0fXClMj6I 4NXILZgXNEaKkE5irenIWtK5+V3SOgBIorEUBdsTgWUB9yexy/4qgqncVQhM1u8dGcpb ANRG/Xkuv3Ba/oVpBOBHBvwl18iWw7RQAYsHUL7WjekM7k3n6lqugc6A0/Estiq+3KtL mB9yuImuhSD1DMK8IrhLrc+qG8GrW4RCc81OomwYI024pqv/lDEEJigvgC7bAW4teHe8 HKJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=ewQsUk2AppJM8fmHZXpWav9UVGTCPmAoBmMIWUJbHXw=; b=FYOwnFdJmUSwE2s2d39Frp+zw72Y4rXiAqyR05fKZOjgNi77Lw2jl3YS6wAakh3p98 Vrf9rqw/4D8MHgNBUiyDp6uwN7UCedIMABNJMFgqw5ivL6tKdsHcUpnh1hil1yxtINmh hfQQ7vFjUYGxBhH7ROuDi/+FiStQWvK7pMx3uMllzPwEUsylMSfjUsNXJXNi20rrMCNo RXHVRp4DP6DoUYZ2N0oLRRq2PK/t/ufsQhe5U5RssqWE1tNuFV2exkmeb6FWSkwrMAgd dbccR0TDhAa/0+np1ZExSkgcHEhUspwCU6ltMgcTgvRqW623sSF/+DgosNWRgPgMn1Vo ETWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o2992baV; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id o1si1784752eds.504.2021.06.10.02.33.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Jun 2021 02:33:30 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o2992baV; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9E9AA82D15; Thu, 10 Jun 2021 11:33:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="o2992baV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2EA1782D6E; Thu, 10 Jun 2021 11:33:24 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4BB0582CBE for ; Thu, 10 Jun 2021 11:33:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ed1-x531.google.com with SMTP id ba2so30434828edb.2 for ; Thu, 10 Jun 2021 02:33:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ewQsUk2AppJM8fmHZXpWav9UVGTCPmAoBmMIWUJbHXw=; b=o2992baV/P+e7E6+WKgX0z+Cz+9PvcEnezRdD4zZRGD+72E5GhG4GpnBdUzTGPcisN S/+6XgCjV1mvgcaq2h0LiOl2atYYsTBj1n9q6uDMt9AFPHKO0aBDB3HbAC53WzAQKo6N JJg0xVeQOuxA98TRt8yAycCFe34JuoKEyg/VpI+NDRc8lPBTNOgDKWjuyE4zOcbbtxDD PiXy6HcsHAuzQMR3RNGQIAZBF1V5uyM7DT94m2C2dxh2SNF5zteoHAa7i3FFideOvUyW 2MQCohN1P0AbjnsKb1kaqtYmUzsYw5wiWAQGZqLDFi1ed2zAVI296x75ukzX+If3gxVF rycA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ewQsUk2AppJM8fmHZXpWav9UVGTCPmAoBmMIWUJbHXw=; b=jq26IYSPM5wQRMaAq05sO5CQ7s1JCbZKS3VyZ3xPoA8gl6Hf2OKpYGS3CdnW/Uh0bT lzVZ79QiVxFK0Oxz9LZJuLfWnjvD7S2XUQcKG3ZTaUJ+a1M8bJVqyCkVIo1HVLScRT4c 2DOzCoMd0Ta5m8ZKKPJ3sJz+iT6pJDsH5DffQie1wDA6SViQwjV1/TLGdYxVordmQrHj 45V80Me42g7kvi9oqozp/7KE/2RJWJ75XvvVp3tccGLPz+/l87tMkQj0/dYeEcOzvdRl 1gv9f0tBO0lb3n8b2fHK4YN8Kkf1ZeAuSKqcQS93ABCwevlaN1Iwjs3FllQz7yZ6fR6n dgWA== X-Gm-Message-State: AOAM533kT9B4eIne2wq+QcFtvatbHQSa1/rlMq1Gp3SOBsk96QYGR+V0 qM8wnfpHtkprWYmLGg1mZhnJ7w== X-Received: by 2002:a05:6402:3c1:: with SMTP id t1mr3789018edw.270.1623317599871; Thu, 10 Jun 2021 02:33:19 -0700 (PDT) Received: from localhost.localdomain (ppp-94-66-220-227.home.otenet.gr. [94.66.220.227]) by smtp.gmail.com with ESMTPSA id z20sm795700ejd.18.2021.06.10.02.33.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Jun 2021 02:33:19 -0700 (PDT) From: Ilias Apalodimas To: xypron.glpk@gmx.de Cc: Ilias Apalodimas , Simon Glass , Bin Meng , Christian Gmeiner , u-boot@lists.denx.de Subject: [PATCH] smbios: Fix SMBIOS tables Date: Thu, 10 Jun 2021 12:33:15 +0300 Message-Id: <20210610093316.833557-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.32.0.rc0 MIME-Version: 1.0 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 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: 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(+) -- 2.32.0.rc0 Acked-by: Heinrich Schuchardt 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;