mirror of https://github.com/acidanthera/audk.git
SourceLevelDebugPkg/DebugAgent: Check PcdDebugPortHandleBufferSize
Check PcdDebugPortHandleBufferSize before allocate buffer. PeriodicMode is BOOLEAN type, needn't to use == TRUE in if condition. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17558 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
cbbb4a8c00
commit
7dd62c4e8b
|
@ -657,7 +657,7 @@ InitializeDebugAgentPhase2 (
|
||||||
MailboxLocation = GetLocationSavedMailboxPointerInIdtEntry ();
|
MailboxLocation = GetLocationSavedMailboxPointerInIdtEntry ();
|
||||||
Mailbox = (DEBUG_AGENT_MAILBOX *)(UINTN)(*MailboxLocation);
|
Mailbox = (DEBUG_AGENT_MAILBOX *)(UINTN)(*MailboxLocation);
|
||||||
BufferSize = PcdGet16(PcdDebugPortHandleBufferSize);
|
BufferSize = PcdGet16(PcdDebugPortHandleBufferSize);
|
||||||
if (Phase2Context->InitFlag == DEBUG_AGENT_INIT_PEI) {
|
if (Phase2Context->InitFlag == DEBUG_AGENT_INIT_PEI && BufferSize != 0) {
|
||||||
NewDebugPortHandle = (UINT64)(UINTN)AllocateCopyPool (BufferSize, DebugPortHandle);
|
NewDebugPortHandle = (UINT64)(UINTN)AllocateCopyPool (BufferSize, DebugPortHandle);
|
||||||
} else {
|
} else {
|
||||||
NewDebugPortHandle = (UINT64)(UINTN)DebugPortHandle;
|
NewDebugPortHandle = (UINT64)(UINTN)DebugPortHandle;
|
||||||
|
|
|
@ -282,7 +282,7 @@ InitializeDebugAgent (
|
||||||
//
|
//
|
||||||
GetApicTimerState (NULL, &PeriodicMode, NULL);
|
GetApicTimerState (NULL, &PeriodicMode, NULL);
|
||||||
TimerCycle = GetApicTimerInitCount ();
|
TimerCycle = GetApicTimerInitCount ();
|
||||||
if (PeriodicMode != TRUE || TimerCycle == 0) {
|
if (!PeriodicMode || TimerCycle == 0) {
|
||||||
InitializeDebugTimer (NULL, FALSE);
|
InitializeDebugTimer (NULL, FALSE);
|
||||||
DisableApicTimerInterrupt ();
|
DisableApicTimerInterrupt ();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue