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

Thanks,
Ray
> -----Original Message-----
> From: Liu, Zhiguang <zhiguang....@intel.com>
> Sent: Thursday, November 30, 2023 2:29 PM
> To: devel@edk2.groups.io
> Cc: Liu, Zhiguang <zhiguang....@intel.com>; Ni, Ray <ray...@intel.com>;
> Kumar, Rahul R <rahul.r.ku...@intel.com>; Gerd Hoffmann
> <kra...@redhat.com>; Laszlo Ersek <ler...@redhat.com>
> Subject: [PATCH v2 1/3] UefiCpuPkg/CpuPageTableLib: Init local variable
> before using it.
> 
> The local variable OneOfPagingEntry is used before initialized, this
> may cause reserved bit in page table entry is set especially in PAE
> paging mode. The bug is random because it depends on the value in
> stack.
> 
> Cc: Ray Ni <ray...@intel.com>
> Cc: Rahul Kumar <rahul1.ku...@intel.com>
> Cc: Gerd Hoffmann <kra...@redhat.com>
> Cc: Laszlo Ersek <ler...@redhat.com>
> Signed-off-by: Zhiguang Liu <zhiguang....@intel.com>
> ---
>  UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
> b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
> index eff02619fa..36b2c4e6a3 100644
> --- a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
> +++ b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
> @@ -338,7 +338,7 @@ PageTableLibMapInLevel (
>    ParentAttribute             = &LocalParentAttribute;
> 
>    OriginalParentPagingEntry.Uint64 = ParentPagingEntry->Uint64;
> -
> +  OneOfPagingEntry.Uint64          = 0;
>    //
>    // RegionLength: 256T (1 << 48) 512G (1 << 39), 1G (1 << 30), 2M (1 << 21)
> or 4K (1 << 12).
>    //
> @@ -367,8 +367,6 @@ PageTableLibMapInLevel (
>        if (RETURN_ERROR (Status)) {
>          return Status;
>        }
> -
> -      OneOfPagingEntry.Pnle.Uint64 = 0;
>      } else {
>        PageTableLibSetPle (Level, &OneOfPagingEntry, 0, &PleBAttribute,
> &AllOneMask);
>      }
> --
> 2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111977): https://edk2.groups.io/g/devel/message/111977
Mute This Topic: https://groups.io/mt/102889278/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: 
https://edk2.groups.io/g/devel/leave/9847357/21656/1706620634/xyzzy 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to