From: Hao Wu Date: Tue, 7 Mar 2017 01:00:48 +0000 (+0800) Subject: UefiCpuPkg/PiSmmCpuDxeSmm: Refine casting result to bigger size X-Git-Tag: edk2-stable201903~4450 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=e62a0eb61b5a37d46e559dc36b41c18fe9b1dc82 UefiCpuPkg/PiSmmCpuDxeSmm: Refine casting result to bigger size The commit is a follow-up of commit 8491e30. In file MpService.c line 786: Pte[Index] = (UINT64)((UINTN)PageTable + EFI_PAGE_SIZE * (Index + 1)) | mAddressEncMask ... (Where PageTable is of type VOID*, Index is of type UINTN, mAddressEncMask is of type UINT64 and Pte[Index] is of type UINT64.) Since in this case, the code logic ensures that the expression will not exceed the range of UINTN, the commit will remove the explicit type cast '(UINT64)'. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu Reviewed-by: Jeff Fan --- diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c index d99ad467b7..a1d16b4570 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c @@ -1,7 +1,7 @@ /** @file SMM MP service implementation -Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
Copyright (c) 2017, AMD Incorporated. All rights reserved.
This program and the accompanying materials @@ -783,7 +783,7 @@ Gen4GPageTable ( // Set Page Directory Pointers // for (Index = 0; Index < 4; Index++) { - Pte[Index] = (UINT64)((UINTN)PageTable + EFI_PAGE_SIZE * (Index + 1)) | mAddressEncMask | + Pte[Index] = ((UINTN)PageTable + EFI_PAGE_SIZE * (Index + 1)) | mAddressEncMask | (Is32BitPageTable ? IA32_PAE_PDPTE_ATTRIBUTE_BITS : PAGE_ATTRIBUTE_BITS); } Pte += EFI_PAGE_SIZE / sizeof (*Pte);