From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0705.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe45::705]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8993E81786 for ; Tue, 10 Jan 2017 08:41:50 -0800 (PST) Received: from DF4PR84MB0140.NAMPRD84.PROD.OUTLOOK.COM (10.162.192.26) by DF4PR84MB0140.NAMPRD84.PROD.OUTLOOK.COM (10.162.192.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.829.7; Tue, 10 Jan 2017 16:41:49 +0000 Received: from DF4PR84MB0140.NAMPRD84.PROD.OUTLOOK.COM ([10.162.192.26]) by DF4PR84MB0140.NAMPRD84.PROD.OUTLOOK.COM ([10.162.192.26]) with mapi id 15.01.0829.013; Tue, 10 Jan 2017 16:41:49 +0000 From: "Phillips, Chris J (Plano, TX)" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: "Ni, Ruiyu" Thread-Topic: [edk2] [PATCH] Nt32Pkg: Fix code to correctly set SMBIOS Type 2 Length Thread-Index: AQHSaw6LSuBo93ibZkuoSJJ76oDxBqExfP+AgABtgRA= Date: Tue, 10 Jan 2017 16:41:49 +0000 Message-ID: References: <07736531-4229-420c-9676-99c2a5e59e5f@AIA2PHNNRN.local> <0C09AFA07DD0434D9E2A0C6AEB0483103B8156BE@shsmsx102.ccr.corp.intel.com> In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103B8156BE@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=chrisp@hpe.com; x-originating-ip: [104.188.247.48] x-ms-office365-filtering-correlation-id: 12763993-d53f-40a1-562c-08d4397792d1 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:DF4PR84MB0140; x-microsoft-exchange-diagnostics: 1; DF4PR84MB0140; 7:zLETwpumpYs+BIiQKtndUrt61PEBAeKOJhXdymIdkkJv44eHQJ7y5PrfN7e9P5CIS/U4xAd0+e33vrzT41Wtr0qwzxQOj/smwteLqmV437vH3ZmNIpVASQAUSIRonoUGB5vIKUQpGZ3dZWKJg9grTlrOUzWxfPpRz/Mul5ZWGwG8z58pEBGM7AT0qlAl4GfsAW4ipdkLnEC0xgw5DAiwKV8o+9Lb1q6Q9d/ATeWcAv4Oua45HTzYczI6nvzc2qygWa1VxVbMzHZZBv9AuAojh0WBhGoMfec7a4Ss9ZrQ/IJozxgsG7jOC5T01BjBLjuD0VDDyHnVteQgIfays6iMz7nckl/jsZxnV7ZvYns/arzDjRm6fdirEpRJnq28kuIHWg9BwKTg9ZfFhvY2899K4X0Mz5fDNWw4CJN3spS39Ji/hRDjxFATGYg6MSuhw8ulygRk5iAbDYyNYNepehl1SA== x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(227479698468861)(162533806227266)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(6072148); SRVR:DF4PR84MB0140; BCL:0; PCL:0; RULEID:; SRVR:DF4PR84MB0140; x-forefront-prvs: 01834E39B7 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(7916002)(39860400002)(39450400003)(39410400002)(39850400002)(39840400002)(189002)(13464003)(377454003)(199003)(102836003)(77096006)(106116001)(106356001)(229853002)(6116002)(2900100001)(3846002)(305945005)(2950100002)(81156014)(97736004)(6506006)(6436002)(7696004)(81166006)(105586002)(5660300001)(55016002)(101416001)(6306002)(74316002)(76176999)(86362001)(54356999)(50986999)(9686003)(4326007)(189998001)(33656002)(8676002)(68736007)(7736002)(8936002)(3660700001)(122556002)(5001770100001)(92566002)(3280700002)(2501003)(66066001)(38730400001)(2906002); DIR:OUT; SFP:1102; SCL:1; SRVR:DF4PR84MB0140; H:DF4PR84MB0140.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: hpe.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: hpe.com X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Jan 2017 16:41:49.1465 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR84MB0140 Subject: Re: [PATCH] Nt32Pkg: Fix code to correctly set SMBIOS Type 2 Length X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2017 16:41:50 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Yes, I'll make the variable name update. Thanks, Chris -----Original Message----- From: Zeng, Star [mailto:star.zeng@intel.com]=20 Sent: Tuesday, January 10, 2017 4:09 AM To: Phillips, Chris J (Plano, TX) ; edk2-devel@lists.01.org Cc: Ni, Ruiyu ; Zeng, Star Subject: RE: [edk2] [PATCH] Nt32Pkg: Fix code to correctly set SMBIOS Type = 2 Length Chris, Could you also correct the typo "Assert" to "Asset"? With the typo fixed, Reviewed-by: Star Zeng Thanks, Star -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Chri= s Phillips Sent: Tuesday, January 10, 2017 2:55 PM To: edk2-devel@lists.01.org Cc: Ni, Ruiyu Subject: [edk2] [PATCH] Nt32Pkg: Fix code to correctly set SMBIOS Type 2 Le= ngth When running Nt32Pkg, SMBIOS Type 2 had the wrong Length. Fixed the code to use the correct structure in sizeof, and properly account= for ContainedObjectHandles. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chris Phillips --- .../MiscBaseBoardManufacturerFunction.c | 16 +++++++++++-= ---- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunct= ion.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction.c index 303726c3fd..26d5d11da6 100644 --- a/Nt32Pkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction.c +++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction. +++ c @@ -3,6 +3,7 @@ SMBIOS type 2. =20 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
+(C) Copyright 2017 Hewlett Packard Enterprise Development LP
This program and the accompanying materials are licensed and made availab= le under the terms and conditions of the BSD License which accompanies thi= s distribution. The full text of the license may be found at @@ -101,11 +1= 02,16 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBaseBoardManufacturer) // // Two zeros following the last string. // - SmbiosRecord =3D AllocatePool(sizeof (SMBIOS_TABLE_TYPE3) + ManuStrLen += 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStr= Len + 1 + ChassisStrLen +1 + 1); - ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE3) + ManuStrLen + 1 + Pro= ductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 = + ChassisStrLen +1 + 1); + // Since we fill NumberOfContainedObjectHandles =3D 0, remove sizeof + (UINT16) bytes for ContainedObjectHandles[1] // SmbiosRecord =3D=20 + AllocatePool(sizeof (SMBIOS_TABLE_TYPE2) - sizeof (UINT16) +=20 + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + + 1 + AssertTagStrLen + 1 + ChassisStrLen + 1 + 1);=20 + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE2) - sizeof (UINT16) +=20 + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + + 1 + AssertTagStrLen + 1 + ChassisStrLen + 1 + 1); =20 SmbiosRecord->Hdr.Type =3D EFI_SMBIOS_TYPE_BASEBOARD_INFORMATION; - SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE2); + // + // Since we fill NumberOfContainedObjectHandles =3D 0, remove sizeof + (UINT16) bytes for ContainedObjectHandles[1] // + SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE2) - sizeof + (UINT16); // // Make handle chosen by smbios protocol.add automatically. // @@ -142,9 +148,9 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBaseBoardManufacturer) =20 OptionalStrStart =3D (CHAR8 *)(SmbiosRecord + 1); // - // Since we fill NumberOfContainedObjectHandles =3D 0 for simple, just a= fter this filed to fill string + // Since we fill NumberOfContainedObjectHandles =3D 0, just after this=20 + field to fill string // - OptionalStrStart -=3D 2; + OptionalStrStart -=3D sizeof (UINT16); UnicodeStrToAsciiStr(Manufacturer, OptionalStrStart); UnicodeStrToAsciiStr(Product, OptionalStrStart + ManuStrLen + 1); UnicodeStrToAsciiStr(Version, OptionalStrStart + ManuStrLen + 1 + Produc= tStrLen + 1); -- 2.11.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel