From nobody Mon Feb 9 23:38:56 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+76307+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76307+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1623289401; cv=none; d=zohomail.com; s=zohoarc; b=hTMRKCCH4q2ylqIxitM6BsxoqN+lEiJ2phPhCJRqTk6RhXle25e3CiCec/waJMew44eBLrjcrvjKhFQppXhjhHBBN6oekSM2yCSKhI0LkzA5jlq5mI2y3W3UVQBEAd7JoHQhFPezCNGy+/7b3Yll095uHXc05a2ExzPrpU5vwPo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623289401; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=vVtOZzykEpYLztNx8WZlaIzVrrnJuKD/FsmEY8AeZPY=; b=W8v+cU87qVbwvuwZl9+7yxb/R4vqx2MIAkYy4qMVqRWh0W4jAYOMwowfxMoWYWgjQpe5k8VaMOMVtWlREly0NDqqRF6XzgbbiwOLHW4Qdwk55KaIIUbksiGCZTjnuZTdPs2yOoB5HHeRNx7OrQt96BD1u3O+4RB1QwwsplAkbNo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+76307+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1623289401383676.1232705562154; Wed, 9 Jun 2021 18:43:21 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id OLuWYY1788612x9GxzRHULgA; Wed, 09 Jun 2021 18:43:21 -0700 X-Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by mx.groups.io with SMTP id smtpd.web09.4467.1623289395591395149 for ; Wed, 09 Jun 2021 18:43:15 -0700 X-Received: by mail-pj1-f41.google.com with SMTP id h16so2684755pjv.2 for ; Wed, 09 Jun 2021 18:43:15 -0700 (PDT) X-Gm-Message-State: 3ISHAZIEs4AfyQbWDgdrwv1mx1787277AA= X-Google-Smtp-Source: ABdhPJyKMccADQtUtj7DGPgmelQbtwO/R5mmzZJiRrmytrj8lEs2E4aMn+9kRXAKDwrA1UTVQHZBxA== X-Received: by 2002:a17:90a:17c6:: with SMTP id q64mr54730pja.56.1623289394919; Wed, 09 Jun 2021 18:43:14 -0700 (PDT) X-Received: from localhost.localdomain ([50.35.88.161]) by smtp.gmail.com with ESMTPSA id p20sm624990pff.204.2021.06.09.18.43.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 18:43:14 -0700 (PDT) From: "Kun Qin" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Eric Dong , Ray Ni Subject: [edk2-devel] [PATCH v1 4/5] MdeModulePkg: SmiHandlerProfileInfo: Updated MessageLength calculation Date: Wed, 9 Jun 2021 18:42:58 -0700 Message-Id: <20210610014259.1151-5-kuqin12@gmail.com> In-Reply-To: <20210610014259.1151-1-kuqin12@gmail.com> References: <20210610014259.1151-1-kuqin12@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kuqin12@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1623289401; bh=zlOF3+W5EuWueN9I5MWuwFPinaIpDy4tJsEhYaTrp+A=; h=Cc:Date:From:Reply-To:Subject:To; b=hWU9u0+jJ4UgcncPk1DcJRK1zzXym2+36c/8g1ieoJr2+dxuA4YWN2CeX+fjnGLzJ8/ /+5pDAPz6zc1CWU1kT4zMTJeVPcIonEPdh0zNlbNQQKx55/Zty5nTbWDGQklb9goGXZrV FmLCFSHld08WgEVD/5XVk49eUMnuWJVRhww= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3398 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 Cc: Hao A Wu Cc: Eric Dong Cc: Ray Ni Signed-off-by: Kun Qin --- MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c | 8= ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfi= leInfo.c b/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfile= Info.c index 4153074b7a80..56d80d1a9ce1 100644 --- a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c +++ b/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.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->MessageLengt= h; + // 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)CommHe= ader->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->MessageLengt= h; + // 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)CommHe= ader->MessageLength; Buffer =3D (UINT8 *)CommHeader + CommSize; Size -=3D CommSize; =20 --=20 2.31.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#76307): https://edk2.groups.io/g/devel/message/76307 Mute This Topic: https://groups.io/mt/83435925/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-