summaryrefslogtreecommitdiffstats
path: root/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c
diff options
context:
space:
mode:
authorkenlautner <85201046+kenlautner@users.noreply.github.com>2024-11-01 12:00:25 -0700
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-11-15 17:50:21 +0000
commit13fad60156f18cf0d2043fb7f05c1dc5e3d91fb7 (patch)
treee922b2c0e2e544488f5339b52926809bb323ab58 /UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c
parent843f0c129ec6e989afee9cf8af36749c8f5b3ffd (diff)
downloadedk2-13fad60156f18cf0d2043fb7f05c1dc5e3d91fb7.tar.gz
UefiCpuPkg: Fix unchecked returns and potential integer overflows
Resolves several issues in UefiCpuPkg related to: 1. Unchecked returns leading to potential NULL or uninitialized access. 2. Potential unchecked integer overflows. 3. Incorrect comparison between integers of different sizes. Co-authored-by: kenlautner <85201046+kenlautner@users.noreply.github.com> Signed-off-by: Chris Fernald <chfernal@microsoft.com>
Diffstat (limited to 'UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c')
-rw-r--r--UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c
index 1be2de4162..1b784eceb8 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c
@@ -118,7 +118,7 @@ GetProtectedModeCS (
AsmReadGdtr (&GdtrDesc);
GdtEntryCount = (GdtrDesc.Limit + 1) / sizeof (IA32_SEGMENT_DESCRIPTOR);
GdtEntry = (IA32_SEGMENT_DESCRIPTOR *)GdtrDesc.Base;
- for (Index = 0; Index < GdtEntryCount; Index++) {
+ for (Index = 0; (UINTN)Index < GdtEntryCount; Index++) {
if (GdtEntry->Bits.L == 0) {
if ((GdtEntry->Bits.Type > 8) && (GdtEntry->Bits.DB == 1)) {
break;