回复: [edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Properly cast from PCD to SEV-ES jump table pointer

gaoliming gaoliming at byosoft.com.cn
Tue May 11 03:04:05 UTC 2021


Reviewed-by: Liming Gao <gaoliming at byosoft.com.cn>

> -----邮件原件-----
> 发件人: devel at edk2.groups.io <devel at edk2.groups.io> 代表 Lendacky,
> Thomas
> 发送时间: 2021年5月10日 22:25
> 收件人: devel at edk2.groups.io
> 抄送: Brijesh Singh <brijesh.singh at amd.com>; Eric Dong
> <eric.dong at intel.com>; Ray Ni <ray.ni at intel.com>; Laszlo Ersek
> <lersek at redhat.com>; Rahul Kumar <rahul1.kumar at intel.com>
> 主题: [edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Properly cast from PCD to
> SEV-ES jump table pointer
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3385
> 
> A VS2012 build fails with a cast conversion warning when the SEV-ES work
> area PCD is cast as a pointer to the SEV_ES_AP_JMP_FAR type.
> 
> When casting from a PCD value to a pointer, the cast should first be done
> to a UINTN and then to the pointer. Update the code to perform a cast to
> a UINTN before casting to a pointer to the SEV_ES_AP_JMP_FAR type.
> 
> Cc: Eric Dong <eric.dong at intel.com>
> Cc: Ray Ni <ray.ni at intel.com>
> Cc: Laszlo Ersek <lersek at redhat.com>
> Cc: Rahul Kumar <rahul1.kumar at intel.com>
> Signed-off-by: Tom Lendacky <thomas.lendacky at amd.com>
> ---
>  UefiCpuPkg/Library/MpInitLib/MpLib.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> index 3d945972a025..dc2a54aa31e8 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> @@ -1265,7 +1265,7 @@ SetSevEsJumpTable (
>    UINT32            Offset, InsnByte;
>    UINT8             LoNib, HiNib;
> 
> -  JmpFar = (SEV_ES_AP_JMP_FAR *) FixedPcdGet32
> (PcdSevEsWorkAreaBase);
> +  JmpFar = (SEV_ES_AP_JMP_FAR *) (UINTN) FixedPcdGet32
> (PcdSevEsWorkAreaBase);
>    ASSERT (JmpFar != NULL);
> 
>    //
> --
> 2.31.0
> 
> 
> 
> 
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#74937): https://edk2.groups.io/g/devel/message/74937
Mute This Topic: https://groups.io/mt/82738081/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list