diff options
author | Zhiguang Liu <zhiguang.liu@intel.com> | 2023-11-27 14:41:52 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2023-12-06 05:30:55 +0000 |
commit | c83ffd267680806483eb22c1cd9c9af83b8aa708 (patch) | |
tree | 44c979eab76e5abf971bb2fdc2cb71f667bbd693 /UefiCpuPkg/Library/CpuPageTableLib | |
parent | ef3fde64aa78598a4c21556629936fb228390e8c (diff) | |
download | edk2-c83ffd267680806483eb22c1cd9c9af83b8aa708.tar.gz edk2-c83ffd267680806483eb22c1cd9c9af83b8aa708.tar.bz2 edk2-c83ffd267680806483eb22c1cd9c9af83b8aa708.zip |
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.
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Diffstat (limited to 'UefiCpuPkg/Library/CpuPageTableLib')
-rw-r--r-- | UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c | 4 |
1 files changed, 1 insertions, 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);
}
|