[edk2-devel] [PATCH 1/1] UefiCpuPkg/PiSmmCpuDxeSmm: Add check for pointer Pml5Entry

Laszlo Ersek lersek at redhat.com
Wed Jul 31 11:28:55 UTC 2019


On 07/31/19 07:56, Shenglei Zhang wrote:
> The pointer Pml5Entry, returned from call to function
> AllocatePageTableMemory, may be null.
> So add check for it.
> 
> Cc: Eric Dong <eric.dong at intel.com>
> Cc: Ray Ni <ray.ni at intel.com>
> Cc: Laszlo Ersek <lersek at redhat.com>
> Signed-off-by: Shenglei Zhang <shenglei.zhang at intel.com>
> ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> index a3b62f778741..d7af3b6d7941 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> @@ -375,6 +375,7 @@ SmmInitPageTable (
>      // Fill PML5 entry
>      //
>      Pml5Entry = (UINT64*)AllocatePageTableMemory (1);
> +    ASSERT (Pml5Entry != NULL);
>      *Pml5Entry = (UINTN) Pml4Entry | mAddressEncMask | PAGE_ATTRIBUTE_BITS;
>      ZeroMem (Pml5Entry + 1, EFI_PAGE_SIZE - sizeof (*Pml5Entry));
>      //
> 

I'm quite unhappy about this *pattern* in "PageTbl.c", but I must agree
that this patch at least makes the new 5-level paging code consistent
with the pattern.

Laszlo

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#44675): https://edk2.groups.io/g/devel/message/44675
Mute This Topic: https://groups.io/mt/32662314/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