From: Heinrich Schuchardt Date: Mon, 1 Jun 2020 13:44:00 +0000 (+0200) Subject: smbios: empty strings in smbios_add_string() X-Git-Url: http://git.dujemihanovic.xyz/img/sics.gif?a=commitdiff_plain;h=00a871d34e2f;p=u-boot.git smbios: empty strings in smbios_add_string() smbios_add_string() cannot deal with empty strings. This leads to incorrect property values and invalid tables. E.g. for the pine64-lts_defconfig CONFIG_SMBIOS_MANUFACTURER="". Linux command dmidecode shows: Table 1: Manufacturer: sunxi Product Name: sunxi Table 3: Invalid entry length (2). DMI table is broken! Stop. Replace empty strings by "Unknown". Signed-off-by: Heinrich Schuchardt --- diff --git a/lib/smbios.c b/lib/smbios.c index 7b74971f68..11790443e1 100644 --- a/lib/smbios.c +++ b/lib/smbios.c @@ -31,6 +31,8 @@ static int smbios_add_string(char *start, const char *str) { int i = 1; char *p = start; + if (!*str) + str = "Unknown"; for (;;) { if (!*p) {