mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-28 16:14:04 +02:00
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>
This commit is contained in:
parent
70425456da
commit
c09b254bdc
@ -100,7 +100,7 @@ SecStartup (
|
|||||||
// |-------------------|----> TempRamBase
|
// |-------------------|----> TempRamBase
|
||||||
IdtTableInStack.PeiService = NULL;
|
IdtTableInStack.PeiService = NULL;
|
||||||
AsmReadIdtr (&IdtDescriptor);
|
AsmReadIdtr (&IdtDescriptor);
|
||||||
if ((IdtDescriptor.Base == 0) && (IdtDescriptor.Limit == 0xFFFF)) {
|
if (IdtDescriptor.Base == 0) {
|
||||||
ExceptionHandler = FspGetExceptionHandler(mIdtEntryTemplate);
|
ExceptionHandler = FspGetExceptionHandler(mIdtEntryTemplate);
|
||||||
for (Index = 0; Index < FixedPcdGet8(PcdFspMaxInterruptSupported); Index ++) {
|
for (Index = 0; Index < FixedPcdGet8(PcdFspMaxInterruptSupported); Index ++) {
|
||||||
CopyMem ((VOID*)&IdtTableInStack.IdtTable[Index], (VOID*)&ExceptionHandler, sizeof (UINT64));
|
CopyMem ((VOID*)&IdtTableInStack.IdtTable[Index], (VOID*)&ExceptionHandler, sizeof (UINT64));
|
||||||
@ -113,9 +113,10 @@ SecStartup (
|
|||||||
// ERROR: IDT table size from boot loader is larger than FSP can support, DeadLoop here!
|
// ERROR: IDT table size from boot loader is larger than FSP can support, DeadLoop here!
|
||||||
//
|
//
|
||||||
CpuDeadLoop();
|
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.Base = (UINTN) &IdtTableInStack.IdtTable;
|
||||||
IdtDescriptor.Limit = (UINT16)(IdtSize - 1);
|
IdtDescriptor.Limit = (UINT16)(IdtSize - 1);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user