public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Andrei Warkentin" <awarkentin@vmware.com>
To: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Leif Lindholm <leif@nuviainc.com>, Pete Batard <pete@akeo.ie>,
	Ard Biesheuvel <ard.biesheuvel@arm.com>
Subject: Re: [edk2-platform][PATCH v1 1/7] Platforms/RaspberryPi: Fix NULL AssetTag in SMBIOS
Date: Mon, 20 Jul 2020 21:52:44 +0000	[thread overview]
Message-ID: <BN6PR05MB3411FE04060EB27D1D70BDF0B97B0@BN6PR05MB3411.namprd05.prod.outlook.com> (raw)
In-Reply-To: <20200720181646.2891-2-Samer.El-Haj-Mahmoud@arm.com>

[-- Attachment #1: Type: text/plain, Size: 2790 bytes --]

Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
________________________________
From: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Sent: Monday, July 20, 2020 1:16 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Leif Lindholm <leif@nuviainc.com>; Pete Batard <pete@akeo.ie>; Andrei Warkentin <awarkentin@vmware.com>; Ard Biesheuvel <ard.biesheuvel@arm.com>
Subject: [edk2-platform][PATCH v1 1/7] Platforms/RaspberryPi: Fix NULL AssetTag in SMBIOS

Commit 6d4fed696d004a6aeb795369aa38d4ce1d39f308 added support for
reporting AssetTag in RPi SMBIOS Types 2 and 3. The default
AssetTag is an empty string. SMBIOS does not allow empty strings to be
referenced from the corresponding string field. This caused breakage in
parsing SMBIOS Types 2 and 3 fields that follow the AssetTag field.

The issue caused an FWTS test failure, as reported in:
https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpftf%2FRPi4%2Fissues%2F75&amp;data=02%7C01%7Cawarkentin%40vmware.com%7C0eeb8c53c3b64e1e2fd008d82cd915f3%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C1%7C637308658172692193&amp;sdata=QPQN3zqWXN4JSJqMK9kN5Ntx%2BFXVZ0Hn1PI1RXxWBt8%3D&amp;reserved=0

The fix is to detect if no AssetTag is set in the UEFI variable, and if
so, change the AssetTag SMBIOS field to an empty blank space.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
---
 Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
index d5fb843d43ce..6eef66f125f8 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
@@ -793,7 +793,13 @@ BoardInfoUpdateSmbiosType2 (
   if (EFI_ERROR (Status)) {
     DEBUG ((DEBUG_ERROR, "Failed to get Asset Tag: %r\n", Status));
   }
-  UnicodeStrToAsciiStrS(AssetTagVar, mChassisAssetTag, sizeof(mChassisAssetTag));
+
+  if (AssetTagVar[0] == L'\0') {
+    // SMBIOS referenced strings cannot be NULL. If no AssetTag is set, default to a blank space.
+    UnicodeStrToAsciiStrS(L" ", mChassisAssetTag, sizeof(mChassisAssetTag));
+  } else {
+    UnicodeStrToAsciiStrS(AssetTagVar, mChassisAssetTag, sizeof(mChassisAssetTag));
+  }
   DEBUG ((DEBUG_INFO, "System Asset Tag : %a\n", mChassisAssetTag));

   LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mBoardInfoType2, mBoardInfoType2Strings, NULL);
--
2.17.1


[-- Attachment #2: Type: text/html, Size: 4400 bytes --]

  reply	other threads:[~2020-07-20 21:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-20 18:16 [edk2-platform][PATCH v1 0/7] Platform/RaspberryPi : SMBIOS fixes and cleanup Samer El-Haj-Mahmoud
2020-07-20 18:16 ` [edk2-platform][PATCH v1 1/7] Platforms/RaspberryPi: Fix NULL AssetTag in SMBIOS Samer El-Haj-Mahmoud
2020-07-20 21:52   ` Andrei Warkentin [this message]
2020-07-20 18:16 ` [edk2-platform][PATCH v1 2/7] Platforms/RaspberryPi: SMBIOS Type 2 and Type 3 fixes Samer El-Haj-Mahmoud
2020-07-20 21:53   ` Andrei Warkentin
2020-07-20 18:16 ` [edk2-platform][PATCH v1 3/7] Platforms/RaspberryPi: SMBIOS Type 0 fixes Samer El-Haj-Mahmoud
2020-07-20 21:53   ` Andrei Warkentin
2020-07-20 18:16 ` [edk2-platform][PATCH v1 4/7] Platforms/RaspberryPi: SMBIOS Type 4 fixes Samer El-Haj-Mahmoud
2020-07-20 21:55   ` Andrei Warkentin
2020-07-20 18:16 ` [edk2-platform][PATCH v1 5/7] Platforms/RaspberryPi: SMBIOS Type 7 fixes Samer El-Haj-Mahmoud
2020-07-20 21:54   ` Andrei Warkentin
2020-07-20 18:16 ` [edk2-platform][PATCH v1 6/7] Platforms/RaspberryPi: SMBIOS Memory Types fixes Samer El-Haj-Mahmoud
2020-07-20 21:55   ` Andrei Warkentin
2020-07-20 18:16 ` [edk2-platform][PATCH v1 7/7] Platforms/RaspberryPi: SMBIOS minor cleanup Samer El-Haj-Mahmoud
2020-08-12 16:27   ` Pete Batard
2020-08-13 13:47 ` [edk2-platform][PATCH v1 0/7] Platform/RaspberryPi : SMBIOS fixes and cleanup Ard Biesheuvel

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-list 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=BN6PR05MB3411FE04060EB27D1D70BDF0B97B0@BN6PR05MB3411.namprd05.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox