From: "Wu, Hao A" <hao.a.wu@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
"kuqin12@gmail.com" <kuqin12@gmail.com>
Cc: "Wang, Jian J" <jian.j.wang@intel.com>,
"Dong, Eric" <eric.dong@intel.com>, "Ni, Ray" <ray.ni@intel.com>
Subject: Re: [edk2-devel] [PATCH v2 4/6] MdeModulePkg: SmiHandlerProfileInfo: Updated MessageLength calculation
Date: Wed, 23 Jun 2021 01:33:20 +0000 [thread overview]
Message-ID: <BN8PR11MB366679DD4B3233F57A5A12A8CA089@BN8PR11MB3666.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210618090243.2517-5-kuqin12@gmail.com>
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kun Qin
> Sent: Friday, June 18, 2021 5:03 PM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>;
> Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>
> Subject: [edk2-devel] [PATCH v2 4/6] MdeModulePkg: SmiHandlerProfileInfo:
> Updated MessageLength calculation
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3398
>
> 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 consumers.
>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
>
> Signed-off-by: Kun Qin <kuqin12@gmail.com>
> ---
>
> Notes:
> v2:
> - Updated comments by removing "BZ" tags [Hao]
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Best Regards,
Hao Wu
>
> MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c
> | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git
> a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo
> .c
> b/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo
> .c
> index 4153074b7a80..4bfd5946caba 100644
> ---
> a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo
> .c
> +++
> b/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileIn
> +++ fo.c
> @@ -116,7 +116,10 @@ GetSmiHandlerProfileDatabase(
> CommGetInfo->Header.ReturnStatus = (UINT64)-1;
> CommGetInfo->DataSize = 0;
>
> - CommSize = sizeof(EFI_GUID) + sizeof(UINTN) + CommHeader-
> >MessageLength;
> + //
> + // The CommHeader->MessageLength contains a definitive value, thus
> UINTN cast is safe here.
> + //
> + CommSize = OFFSET_OF(EFI_SMM_COMMUNICATE_HEADER, Data) +
> + (UINTN)CommHeader->MessageLength;
> Status = SmmCommunication->Communicate(SmmCommunication,
> CommBuffer, &CommSize);
> if (EFI_ERROR(Status)) {
> Print(L"SmiHandlerProfile: SmmCommunication - %r\n", Status); @@ -
> 149,7 +152,10 @@ GetSmiHandlerProfileDatabase(
> CommGetData->Header.DataLength = sizeof(*CommGetData);
> CommGetData->Header.ReturnStatus = (UINT64)-1;
>
> - CommSize = sizeof(EFI_GUID) + sizeof(UINTN) + CommHeader-
> >MessageLength;
> + //
> + // The CommHeader->MessageLength contains a definitive value, thus
> UINTN cast is safe here.
> + //
> + CommSize = OFFSET_OF(EFI_SMM_COMMUNICATE_HEADER, Data) +
> + (UINTN)CommHeader->MessageLength;
> Buffer = (UINT8 *)CommHeader + CommSize;
> Size -= CommSize;
>
> --
> 2.31.1.windows.1
>
>
>
>
>
next prev parent reply other threads:[~2021-06-23 1:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-18 9:02 [PATCH v2 0/6] EDK2 Code First: PI Specification: Update EFI_MM_COMMUNICATE_HEADER Kun Qin
2021-06-18 9:02 ` [PATCH v2 1/6] EDK2 Code First: PI Specification: EFI_MM_COMMUNICATE_HEADER Update Kun Qin
2021-06-23 10:02 ` [edk2-devel] " Laszlo Ersek
2021-06-24 0:28 ` Kun Qin
2021-06-18 9:02 ` [PATCH v2 2/6] MdeModulePkg: PiSmmIpl: Update MessageLength calculation for MmCommunicate Kun Qin
2021-06-18 9:02 ` [PATCH v2 3/6] MdeModulePkg: MemoryProfileInfo: Updated MessageLength calculation Kun Qin
2021-06-23 1:33 ` [edk2-devel] " Wu, Hao A
2021-06-18 9:02 ` [PATCH v2 4/6] MdeModulePkg: SmiHandlerProfileInfo: " Kun Qin
2021-06-23 1:33 ` Wu, Hao A [this message]
2021-06-18 9:02 ` [PATCH v2 5/6] MdeModulePkg: SmmLockBoxDxeLib: " Kun Qin
2021-06-23 1:33 ` Wu, Hao A
2021-06-18 9:02 ` [PATCH v2 6/6] MdePkg: MmCommunication: Extend MessageLength field size to UINT64 Kun Qin
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=BN8PR11MB366679DD4B3233F57A5A12A8CA089@BN8PR11MB3666.namprd11.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