From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.72]) by mx.groups.io with SMTP id smtpd.web11.6209.1595281966054657822 for ; Mon, 20 Jul 2020 14:52:46 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@vmware.com header.s=selector2 header.b=JtLr5/s8; spf=pass (domain: vmware.com, ip: 40.107.220.72, mailfrom: awarkentin@vmware.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FNlxfVgyRXfcRXMPvpcImXRMBRwKjl/PT673/RFDJq1af3wqD1ZVxyZV9sI5eBOQRvmrP5ch2jLC+13ELIPedGPl5LRoKVWAyeVbkzfkn0/lVOlbBkFgWmSJxjYCYa6nNfTgIt/aO8faBWQMj/iknWz0iWNjF5VDF4Aq2TmPHYWsq/L/Kdkn1C0D/7yrSgZViWLzlfam/uv7g+1tPx5eJvAGR9ym8eNT04m2gz8G3rOP1laqwJjFufEVhy1I7YyfD5yipsn/sgs9hfLkyKVk7if6yDZfJ02Hmnmq9d6Ileb3nSelsXRCh2wbU7JfvF77Wfqxom9R4vJ7uEm7WEz4Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PRD56dk2B+JFQRYcf8L5E7pja3qOorTcU2ht5eqzXgQ=; b=EzhXm9CNenL8X5e14yAFwh1lnYsGaj39dNRyAzEYxrQaV2z31uHd6FSlD4g4cg3Qzo+O+yEqY32ewdMZehqHadRTtYlVb/dYL6iPHLaojnnAqHEkow9rJ0s5rcIiRnF1IpR2AGaiWIPucz7ymecgsmW/gD/1mI09yGia4HaX1dNcb1lo8wMs8DKiQm83Qo/5Mb/uaGKBGpqPwPFgNGy/eQaKcwhTQWM6SLMSWGejxmM8ItqMDw8aNX8CciM4lHUF3iGIN2KTKsdrHAN/U/h8CzRRlnZKzCsq3Sh+7LUaGV59BHHBiofXllT+AGPSWyuTHYWUwHNirisqqPgoq9JWAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vmware.com; dmarc=pass action=none header.from=vmware.com; dkim=pass header.d=vmware.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vmware.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PRD56dk2B+JFQRYcf8L5E7pja3qOorTcU2ht5eqzXgQ=; b=JtLr5/s8dAxY/63hu7zX0Y0B1DhRvSKa/dULmwfgsu9W2THXxwdPokxVnlhwiSwDwBG8N3yhOowDNwoU+lbN67mBmwVG8eyzGurwaqWPMZlqnVluX1xgMG+rbFfMNXnLUTiUkD9RNTNgbC41ySa0TsidVRHABgyEz+F4Ig0e8vo= Received: from BN6PR05MB3411.namprd05.prod.outlook.com (2603:10b6:405:43::23) by BN7PR05MB4545.namprd05.prod.outlook.com (2603:10b6:406:fa::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.17; Mon, 20 Jul 2020 21:52:44 +0000 Received: from BN6PR05MB3411.namprd05.prod.outlook.com ([fe80::e1ef:31eb:c802:aef0]) by BN6PR05MB3411.namprd05.prod.outlook.com ([fe80::e1ef:31eb:c802:aef0%3]) with mapi id 15.20.3216.017; Mon, 20 Jul 2020 21:52:44 +0000 From: "Andrei Warkentin" To: Samer El-Haj-Mahmoud , "devel@edk2.groups.io" CC: Leif Lindholm , Pete Batard , Ard Biesheuvel Subject: Re: [edk2-platform][PATCH v1 1/7] Platforms/RaspberryPi: Fix NULL AssetTag in SMBIOS Thread-Topic: [edk2-platform][PATCH v1 1/7] Platforms/RaspberryPi: Fix NULL AssetTag in SMBIOS Thread-Index: AQHWXsH02DQ5SzSmwUSfNgXEyXTi+akRAoDG Date: Mon, 20 Jul 2020 21:52:44 +0000 Message-ID: References: <20200720181646.2891-1-Samer.El-Haj-Mahmoud@arm.com>,<20200720181646.2891-2-Samer.El-Haj-Mahmoud@arm.com> In-Reply-To: <20200720181646.2891-2-Samer.El-Haj-Mahmoud@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=vmware.com; x-originating-ip: [98.214.99.181] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 07345e2a-07be-4d96-cb3d-08d82cf73bde x-ms-traffictypediagnostic: BN7PR05MB4545: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: slO4rNaN8cSCuemzITskJWeikTjo6kpGpo+DhWuzYlD6XZmUdafktWWsNLjtPht8TYm16WcZc5r5eQudRr/ETolcCQbTWADrvJ0rDqQlwEQ6KLRPMdTxDBcSELnBfA1med6mRu1mcknzirPOXqFX8Ntkf6Y0ko5F6Y3Zu689UbKoBC470AjUYyZtpWC+T8pbw7ZJPKG/KN024mAcV2JQWtW7/bQKnbkNMHEKTxmuNcbcs+8x5wREs8Pmv2KBH39XgXEFX4uLopKiTXUJm0k+6awTY2h4cHXgyfiXjstVKe6kKdr6JvgkkRnsm47QB7WqjE1QeIcPRaCGiS7/aBKnPXn9U9F6J3mwu5eB/XSHxE3lCIAHTVpvZ9nnar0cWVYK5LKI+uwmDOzT5hjrHDPGNQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN6PR05MB3411.namprd05.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(396003)(136003)(376002)(346002)(366004)(39860400002)(8936002)(316002)(71200400001)(966005)(4326008)(186003)(478600001)(52536014)(110136005)(2906002)(54906003)(26005)(45080400002)(19627235002)(19627405001)(8676002)(64756008)(66556008)(66476007)(66946007)(76116006)(53546011)(7696005)(33656002)(6506007)(83380400001)(55016002)(5660300002)(166002)(9686003)(86362001)(66446008);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: l5GCez3dCvq+4PqVgsYYphjbskv2EiH6s+aJhRkvqkOff1BfrkVWXcJ+Ni0y0ibf9Kvs45n0d9F0gENhs7116qlv/aKmnfiPLcxKKs3wps5FYxCjmQGf8uTcXjmKxrrSkoltvhaCvOih95K0VrUUMsA20hEfQ0Kbs9U7o3mH2Ptff2MMNvy+7iwv/OcqcPBuXxHaLV0YSXeCSkKW2C3BnuHDi87B0hMfp4M1t/8y64EZqfyZi1/yAePM97I5E2kJah8Y2lrABW8ghRTr4qf+PWBBYjQtlQtDiMJiNd0uBWbNz4ACH4guMYCBbXlq4o8AmlacJ/slccsyYMJwgKvMWUHrLxVygRmA0N5oOrCw5sc+3TPE2G0Kk5VGEhhr/jYbt/MmWuCYq4ABAfGd4LVFUqyRrK4kU1grAsZ4xGLm7tbVAvkPyKvBTyj0TSJGDKgtx2QKb3CkfE1YlmaQr2wYn/+aWqEVJ1mvE8HgJBFfjEmi2kKKQVHX+zGSYEB18vQG x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN6PR05MB3411.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 07345e2a-07be-4d96-cb3d-08d82cf73bde X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jul 2020 21:52:44.4836 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: s0+1lg8ey7gqMqh665B7kgzMwur2rJ4R5TiDxMjVrmxRpMgutmuzUfBINVolO8TZlUPSzVYaxcP6EXA+HjgiZA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR05MB4545 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_BN6PR05MB3411FE04060EB27D1D70BDF0B97B0BN6PR05MB3411namp_" --_000_BN6PR05MB3411FE04060EB27D1D70BDF0B97B0BN6PR05MB3411namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Andrei Warkentin ________________________________ From: Samer El-Haj-Mahmoud Sent: Monday, July 20, 2020 1:16 PM To: devel@edk2.groups.io Cc: Leif Lindholm ; Pete Batard ; Andrei W= arkentin ; Ard Biesheuvel Subject: [edk2-platform][PATCH v1 1/7] Platforms/RaspberryPi: Fix NULL Asse= tTag 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=3Dhttps%3A%2F%2Fgithub.= com%2Fpftf%2FRPi4%2Fissues%2F75&data=3D02%7C01%7Cawarkentin%40vmware.co= m%7C0eeb8c53c3b64e1e2fd008d82cd915f3%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0= %7C1%7C637308658172692193&sdata=3DQPQN3zqWXN4JSJqMK9kN5Ntx%2BFXVZ0Hn1PI= 1RXxWBt8%3D&reserved=3D0 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 Cc: Pete Batard Cc: Andrei Warkentin Cc: Ard Biesheuvel Signed-off-by: Samer El-Haj-Mahmoud --- Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 8 +++= ++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosD= xe.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(mChassisAsse= tTag)); + + if (AssetTagVar[0] =3D=3D L'\0') { + // SMBIOS referenced strings cannot be NULL. If no AssetTag is set, de= fault to a blank space. + UnicodeStrToAsciiStrS(L" ", mChassisAssetTag, sizeof(mChassisAssetTag)= ); + } else { + UnicodeStrToAsciiStrS(AssetTagVar, mChassisAssetTag, sizeof(mChassisAs= setTag)); + } DEBUG ((DEBUG_INFO, "System Asset Tag : %a\n", mChassisAssetTag)); LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mBoardInfoType2, mBoardInfoTyp= e2Strings, NULL); -- 2.17.1 --_000_BN6PR05MB3411FE04060EB27D1D70BDF0B97B0BN6PR05MB3411namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Reviewed-by: Andrei Warken= tin <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@ak= eo.ie>; Andrei Warkentin <awarkentin@vmware.com>; Ard Biesheuvel &= lt;ard.biesheuvel@arm.com>
Subject: [edk2-platform][PATCH v1 1/7] Platforms/RaspberryPi: Fix NU= LL AssetTag in SMBIOS
 
Commit 6d4fed696d004a6aeb795369aa38d4ce1d39f308 ad= ded 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.safelink= s.protection.outlook.com/?url=3Dhttps%3A%2F%2Fgithub.com%2Fpftf%2FRPi4%2Fis= sues%2F75&amp;data=3D02%7C01%7Cawarkentin%40vmware.com%7C0eeb8c53c3b64e= 1e2fd008d82cd915f3%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C1%7C63730865817= 2692193&amp;sdata=3DQPQN3zqWXN4JSJqMK9kN5Ntx%2BFXVZ0Hn1PI1RXxWBt8%3D&am= p;amp;reserved=3D0

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/PlatformSmbiosD= xe.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(mChassi= sAssetTag));
+
+  if (AssetTagVar[0] =3D=3D L'\0') {
+    // SMBIOS referenced strings cannot be NULL. If no Asse= tTag is set, default to a blank space.
+    UnicodeStrToAsciiStrS(L" ", mChassisAssetTag,= sizeof(mChassisAssetTag));
+  } else {
+    UnicodeStrToAsciiStrS(AssetTagVar, mChassisAssetTag, si= zeof(mChassisAssetTag));
+  }
   DEBUG ((DEBUG_INFO, "System Asset Tag : %a\n", mChas= sisAssetTag));
 
   LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mBoardInfoType2,= mBoardInfoType2Strings, NULL);
--
2.17.1

--_000_BN6PR05MB3411FE04060EB27D1D70BDF0B97B0BN6PR05MB3411namp_--