From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web11.5434.1623397629586039884 for ; Fri, 11 Jun 2021 00:47:09 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=AwMUIBsX; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: hao.a.wu@intel.com) IronPort-SDR: ahPj2vSUtkaY80ffQLdLPX4qX1IJ2PHGSlqI1s8aF5YeEj6tgQWjpYjpjCR36NlhSxrm2qJTm6 5rxhL+FeIZjA== X-IronPort-AV: E=McAfee;i="6200,9189,10011"; a="203647165" X-IronPort-AV: E=Sophos;i="5.83,265,1616482800"; d="scan'208";a="203647165" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2021 00:47:08 -0700 IronPort-SDR: OaKYtM8hEhncOdvr2JL8zx5uH2sOE0DbiV5b7oH66vwerexoIsDdmw/GgnPxh58KGYSdQC1KyT PM+G3oB9q05A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,265,1616482800"; d="scan'208";a="486501184" Received: from orsmsx604.amr.corp.intel.com ([10.22.229.17]) by fmsmga002.fm.intel.com with ESMTP; 11 Jun 2021 00:47:08 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Fri, 11 Jun 2021 00:47:07 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4 via Frontend Transport; Fri, 11 Jun 2021 00:47:07 -0700 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (104.47.73.49) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.4; Fri, 11 Jun 2021 00:47:07 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=il+BHH3KHwq6E4nbIx/r4cCi3d29SBEAuvfHAZ3Oy0/fUI6cVhrEzxtuzHypT6KgLWp8cb6JxvUo5EHnfjZ2RpKsmsu4w4KFAqaWdhMg/w5/SrDwzzZjYIEz/lDjaGP36mEXVbbW60AMVt6ZtT+wCajO3hl+cvepwOhCsNh+NXcPC8SmA8GGNDc1pCeqBJiUcxAOtYzTgFd4petU0K/8/GGTHjtjyRH4qSNNaB1O1mwHYsg4I/tK3+5snxGCgkIyyPo6/cccX+EE9eLIyU6YcKvlRMhZUgjbkJ0oDAjzPKpNkVXaX8zHCTfH7Ev7BRwFugDLiaH3374Zc2pARuLR5g== 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=pv1qXuSkS6K79WGKJle3nyYGiZ3SD1BY7NSNhsMMcUg=; b=QIFvj8OsL8HykES+LToxNrK1yWB8Vl+F6kz00qI7PkpzwDj4Of1AhoTXDWT9PuHn7xedYPS+UhVLikDOdTH0UBUsLEJ5a1g5Yg/mIjjAMKQZ0Vpwi0wCvRFzfpAMUqBeaqTWifjgfuIDna42/79rf2HFoC+Pbl1Ex4txilE9zc1oM8kkLhXKANBo2YUb+Il38XQ60ZC8AyoY/fZEg3ZzN1grJEuRAQLOI+RJ4iMkNlvwa/hH2Ts8FhfDwRE1cn33LW0ckR9ycBhWnSnFJsEPIHscb9xRH4NqV6lJRE0b+QRECziFRBYREANHBydhA8SlX6xAYXvMqlZ1QkssEiCwTA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pv1qXuSkS6K79WGKJle3nyYGiZ3SD1BY7NSNhsMMcUg=; b=AwMUIBsXHiuLn5NHMHkWG+QhL2BeM/4mra8g0o17hlgt3lc2wmMQRFyqSaULvC6mS4MrPM6YDm0UixLzLNabUOIBYucS+aUpSbUSezS7vMYrYb6QLitnCYvTBe+ItnaHoZQW0YFauXA9PXAov7tOmqX6tP1onj4OsrQH3c0hhpA= Received: from BN8PR11MB3666.namprd11.prod.outlook.com (2603:10b6:408:8c::19) by BN6PR1101MB2161.namprd11.prod.outlook.com (2603:10b6:405:52::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.26; Fri, 11 Jun 2021 07:47:01 +0000 Received: from BN8PR11MB3666.namprd11.prod.outlook.com ([fe80::b9d0:5694:1b70:c031]) by BN8PR11MB3666.namprd11.prod.outlook.com ([fe80::b9d0:5694:1b70:c031%4]) with mapi id 15.20.4195.032; Fri, 11 Jun 2021 07:47:01 +0000 From: "Wu, Hao A" To: Kun Qin , "devel@edk2.groups.io" CC: "Wang, Jian J" , "Dong, Eric" , "Ni, Ray" Subject: Re: [PATCH v1 4/5] MdeModulePkg: SmiHandlerProfileInfo: Updated MessageLength calculation Thread-Topic: [PATCH v1 4/5] MdeModulePkg: SmiHandlerProfileInfo: Updated MessageLength calculation Thread-Index: AQHXXZoGDwe1W5adrE+NMvZAsY5NsKsObJ9g Date: Fri, 11 Jun 2021 07:47:00 +0000 Message-ID: References: <20210610014259.1151-1-kuqin12@gmail.com> <20210610014259.1151-5-kuqin12@gmail.com> In-Reply-To: <20210610014259.1151-5-kuqin12@gmail.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.143.16] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b2dcc999-1c1b-4391-f574-08d92cad190d x-ms-traffictypediagnostic: BN6PR1101MB2161: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1923; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: VeJ6ZNc0VJoJJ6pmtS9Y569uA9/W1Y6qEfWWshua65QCI47AQR5JvyeSp+uV3UiwPt6ijBbZZQQyY87SriWocLa2n7BtUwymYXwUgSFsWiUV7xe9rzRSDyL4xhLCsvs8JrcPhpVKbLFd70A99/ksI5gDa4qV/gKKMKoLxlRcxGpuiF8IqRNiyp/BUnmCnuGPKxzW8Q2ncJi2Zr8lpjtqOv8RybKcVGxCmM6SIoYpno4h2x6n6+euVnprezV/o+b8WcX6i6/Hyi2oW07MjJ/j5WQpvPfd3YUsZj1vx0vr6I26T8lrhbfz5didLzcGRhNxvE4tqZD6huWdWhO6K3SV5gtgxd0vQuQ5XLxuhs0yufWiR2trRF9/s95TXbz3gZVO9JiOgNM4dywnlWWbfevQa7j95N366i9JRZlA+SjnfBA5HGSCLgDX/xXCaGLPIwjTV+dpLDwKVloKPaDn7PjByUo7dIS4uCXx9udkob/zqkh6AonXCFmTXVY8YyIjCxmz9TfVAdxzJRRj/HZKUllFvoTGWeH657QSXo7TDrAHZMZ+qFiF4N7ZQ/c8ROBIAMWy7qSjnrRBh1VQtZmrEDvPt21yxhCNiSL9GAiG6V9NOyP7KWtK7P+9XxOKjlAkT2dIBYFZo+cxlkmp0v1pvO2nafEN6JOPiDqfAiGKYXp6e2lDIu11XSOsA0TmPpDio2SAWvqM89TIV+fA6iF2/AfgLoKQSpRwQWldRKxJO4doIoY= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR11MB3666.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(366004)(376002)(136003)(396003)(39860400002)(52536014)(54906003)(107886003)(66946007)(15650500001)(76116006)(86362001)(2906002)(110136005)(66446008)(4326008)(6506007)(316002)(66556008)(7696005)(38100700002)(8936002)(33656002)(478600001)(66476007)(64756008)(53546011)(966005)(8676002)(9686003)(55016002)(5660300002)(71200400001)(186003)(122000001)(83380400001)(26005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?qm6ag2PLh3yzkxeJw7pvHncrq5ZVhP06RQHg7Mqp6RUQJZmgoRh2j1c5bUXC?= =?us-ascii?Q?xPjVSd3THtmwpjq9nFHZ16LyXdA5huTOS+CRBqZT5fTWKRxfiKjz5ojhFtmI?= =?us-ascii?Q?DV+u3XaAyx3hLaqITIKHWl7CfCaZqrS34n9FCPxGIa9a0k48a15mDZ6L1sGK?= =?us-ascii?Q?41vw6oOfxReCA8H1QzFolRNFd6L1xEYJXuyi1AJ5ykkyPCSwAMdR0QG6PltC?= =?us-ascii?Q?+G71i7eB6Fi84PdMfjnIkpICbPxM7T1Hro/q7tzlpE0x4Goq2BjKI/Td83nT?= =?us-ascii?Q?taB71p4CpbpMxtC3j21oyPkzctCo01Zfpn569ICq2mZ+l2g4TqPp/YMFzhRf?= =?us-ascii?Q?TihW4VYZ6x59CM44Kxcs8rDa/0WW8+7W/gY0j8qm1/VhWV7M1gRKgAOPDaal?= =?us-ascii?Q?3lGYrHGx2sO7pHOlntZaSD+nayATEpXIlWBmudTlsy8X9yc/KLIN10wlM15u?= =?us-ascii?Q?bGkk3hWssnrdBrvKgB9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internal X-MS-Exchange-CrossTenant-AuthSource: BN8PR11MB3666.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b2dcc999-1c1b-4391-f574-08d92cad190d X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jun 2021 07:47:00.9896 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 8x2uVP/qKjCMzIj/FXJWVwHpw10p/0hpsxn/UA0Mb0Q12zQxxy3ybRWOyGK3amU6uFzBiDl4agyZMexbw0rLfA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1101MB2161 Return-Path: hao.a.wu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Kun Qin > Sent: Thursday, June 10, 2021 9:43 AM > To: devel@edk2.groups.io > Cc: Wang, Jian J ; Wu, Hao A ; > Dong, Eric ; Ni, Ray > Subject: [PATCH v1 4/5] MdeModulePkg: SmiHandlerProfileInfo: Updated > MessageLength calculation >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3398 >=20 > This change replaced the calculation of communication buffer size from > explicitly adding the size of each member with the OFFSET macro function. > This will make the structure field defition change transparent to consume= rs. >=20 > Cc: Jian J Wang > Cc: Hao A Wu > Cc: Eric Dong > Cc: Ray Ni >=20 > Signed-off-by: Kun Qin > --- > MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c > | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) >=20 > diff --git > a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo > .c > b/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo > .c > index 4153074b7a80..56d80d1a9ce1 100644 > --- > a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo > .c > +++ > b/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileIn > +++ fo.c > @@ -116,7 +116,9 @@ GetSmiHandlerProfileDatabase( > CommGetInfo->Header.ReturnStatus =3D (UINT64)-1; > CommGetInfo->DataSize =3D 0; >=20 > - CommSize =3D sizeof(EFI_GUID) + sizeof(UINTN) + CommHeader- > >MessageLength; > + // BZ3398: Make MessageLength the same size in > EFI_MM_COMMUNICATE_HEADER for both IA32 and X64. Similar comments as in patch 3/5. Best Regards, Hao Wu > + // The CommHeader->MessageLength contains a definitive value, thus > UINTN cast is safe here. > + CommSize =3D OFFSET_OF(EFI_SMM_COMMUNICATE_HEADER, Data) + > + (UINTN)CommHeader->MessageLength; > Status =3D SmmCommunication->Communicate(SmmCommunication, > CommBuffer, &CommSize); > if (EFI_ERROR(Status)) { > Print(L"SmiHandlerProfile: SmmCommunication - %r\n", Status); @@ - > 149,7 +151,9 @@ GetSmiHandlerProfileDatabase( > CommGetData->Header.DataLength =3D sizeof(*CommGetData); > CommGetData->Header.ReturnStatus =3D (UINT64)-1; >=20 > - CommSize =3D sizeof(EFI_GUID) + sizeof(UINTN) + CommHeader- > >MessageLength; > + // BZ3398: Make MessageLength the same size in > EFI_MM_COMMUNICATE_HEADER for both IA32 and X64. > + // The CommHeader->MessageLength contains a definitive value, thus > UINTN cast is safe here. > + CommSize =3D OFFSET_OF(EFI_SMM_COMMUNICATE_HEADER, Data) + > + (UINTN)CommHeader->MessageLength; > Buffer =3D (UINT8 *)CommHeader + CommSize; > Size -=3D CommSize; >=20 > -- > 2.31.1.windows.1