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:
Jeff Fan 2015-06-04 05:34:46 +00:00 committed by vanjeff
parent cbbb4a8c00
commit 7dd62c4e8b
2 changed files with 2 additions and 2 deletions

View File

@ -657,7 +657,7 @@ InitializeDebugAgentPhase2 (
MailboxLocation = GetLocationSavedMailboxPointerInIdtEntry ();
Mailbox = (DEBUG_AGENT_MAILBOX *)(UINTN)(*MailboxLocation);
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);
} else {
NewDebugPortHandle = (UINT64)(UINTN)DebugPortHandle;

View File

@ -282,7 +282,7 @@ InitializeDebugAgent (
//
GetApicTimerState (NULL, &PeriodicMode, NULL);
TimerCycle = GetApicTimerInitCount ();
if (PeriodicMode != TRUE || TimerCycle == 0) {
if (!PeriodicMode || TimerCycle == 0) {
InitializeDebugTimer (NULL, FALSE);
DisableApicTimerInterrupt ();
}