diff options
author | Chasel, Chiu <chasel.chiu@intel.com> | 2018-10-26 15:12:33 +0800 |
---|---|---|
committer | Chasel, Chiu <chasel.chiu@intel.com> | 2018-10-29 11:24:58 +0800 |
commit | c09b254bdc6050cc8b580a26558f692f958645d6 (patch) | |
tree | 6a453855ecf4e84ab31b3fe532d4cda923cbc737 /IntelFsp2Pkg | |
parent | 70425456dae16fca23540936c8fb0d2b86776b97 (diff) | |
download | edk2-c09b254bdc6050cc8b580a26558f692f958645d6.tar.gz |
IntelFsp2Pkg: Fixed potentially NULL pointer accessing
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1280
When copying IDT table in SecMain, the pointer might be
NULL so added the check to fix it.
Test: Verified on internal platform and boots successfully.
Cc: Jiewen Yao <Jiewen.yao@intel.com>
Cc: Desimone Nathaniel L <nathaniel.l.desimone@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Diffstat (limited to 'IntelFsp2Pkg')
-rw-r--r-- | IntelFsp2Pkg/FspSecCore/SecMain.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/IntelFsp2Pkg/FspSecCore/SecMain.c b/IntelFsp2Pkg/FspSecCore/SecMain.c index f319c68cc5..70460a3c8b 100644 --- a/IntelFsp2Pkg/FspSecCore/SecMain.c +++ b/IntelFsp2Pkg/FspSecCore/SecMain.c @@ -100,7 +100,7 @@ SecStartup ( // |-------------------|----> TempRamBase
IdtTableInStack.PeiService = NULL;
AsmReadIdtr (&IdtDescriptor);
- if ((IdtDescriptor.Base == 0) && (IdtDescriptor.Limit == 0xFFFF)) {
+ if (IdtDescriptor.Base == 0) {
ExceptionHandler = FspGetExceptionHandler(mIdtEntryTemplate);
for (Index = 0; Index < FixedPcdGet8(PcdFspMaxInterruptSupported); Index ++) {
CopyMem ((VOID*)&IdtTableInStack.IdtTable[Index], (VOID*)&ExceptionHandler, sizeof (UINT64));
@@ -113,8 +113,9 @@ SecStartup ( // ERROR: IDT table size from boot loader is larger than FSP can support, DeadLoop here!
//
CpuDeadLoop();
+ } else {
+ CopyMem ((VOID *) (UINTN) &IdtTableInStack.IdtTable, (VOID *) IdtDescriptor.Base, IdtSize);
}
- CopyMem ((VOID *) (UINTN) &IdtTableInStack.IdtTable, (VOID *) IdtDescriptor.Base, IdtSize);
}
IdtDescriptor.Base = (UINTN) &IdtTableInStack.IdtTable;
IdtDescriptor.Limit = (UINT16)(IdtSize - 1);
|