public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/1] UefiCpuPkg/PiSmmCpuDxeSmm: Add check for pointer Pml5Entry
@ 2019-07-31  5:56 Zhang, Shenglei
  2019-07-31  6:03 ` Ni, Ray
  2019-07-31 11:28 ` Laszlo Ersek
  0 siblings, 2 replies; 3+ messages in thread
From: Zhang, Shenglei @ 2019-07-31  5:56 UTC (permalink / raw)
  To: devel, edk2-devel; +Cc: Eric Dong, Ray Ni, Laszlo Ersek

The pointer Pml5Entry, returned from call to function
AllocatePageTableMemory, may be null.
So add check for it.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@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));
     //
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] UefiCpuPkg/PiSmmCpuDxeSmm: Add check for pointer Pml5Entry
  2019-07-31  5:56 [PATCH 1/1] UefiCpuPkg/PiSmmCpuDxeSmm: Add check for pointer Pml5Entry Zhang, Shenglei
@ 2019-07-31  6:03 ` Ni, Ray
  2019-07-31 11:28 ` Laszlo Ersek
  1 sibling, 0 replies; 3+ messages in thread
From: Ni, Ray @ 2019-07-31  6:03 UTC (permalink / raw)
  To: Zhang, Shenglei, devel@edk2.groups.io, edk2-devel@lists.01.org
  Cc: Dong, Eric, Laszlo Ersek

Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: Zhang, Shenglei
> Sent: Wednesday, July 31, 2019 1:57 PM
> To: devel@edk2.groups.io; edk2-devel@lists.01.org
> Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Laszlo
> Ersek <lersek@redhat.com>
> Subject: [PATCH 1/1] UefiCpuPkg/PiSmmCpuDxeSmm: Add check for pointer
> Pml5Entry
> 
> The pointer Pml5Entry, returned from call to function
> AllocatePageTableMemory, may be null.
> So add check for it.
> 
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Shenglei Zhang <shenglei.zhang@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));
>      //
> --
> 2.18.0.windows.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] UefiCpuPkg/PiSmmCpuDxeSmm: Add check for pointer Pml5Entry
  2019-07-31  5:56 [PATCH 1/1] UefiCpuPkg/PiSmmCpuDxeSmm: Add check for pointer Pml5Entry Zhang, Shenglei
  2019-07-31  6:03 ` Ni, Ray
@ 2019-07-31 11:28 ` Laszlo Ersek
  1 sibling, 0 replies; 3+ messages in thread
From: Laszlo Ersek @ 2019-07-31 11:28 UTC (permalink / raw)
  To: Shenglei Zhang, devel, edk2-devel; +Cc: Eric Dong, Ray Ni

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@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Shenglei Zhang <shenglei.zhang@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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-31 11:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-31  5:56 [PATCH 1/1] UefiCpuPkg/PiSmmCpuDxeSmm: Add check for pointer Pml5Entry Zhang, Shenglei
2019-07-31  6:03 ` Ni, Ray
2019-07-31 11:28 ` Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox