From: mdkinney Date: Thu, 30 Dec 2010 22:29:54 +0000 (+0000) Subject: Prevent a NULL device path from being passed into REPORT_STATUS_CODE_WITH_DEVICE_PATH... X-Git-Tag: edk2-stable201903~15265 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=abef1c7a096faf26c0bb32897de6cf07ec256863 Prevent a NULL device path from being passed into REPORT_STATUS_CODE_WITH_DEVICE_PATH by building child device path before using any of the Serial I/O Protocol services. This guarantees that child device path is valid even if an error is returned from one of Serial I/O Protocol services in Start(). git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11210 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c index 7732db8b38..04c79aff5a 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c @@ -737,29 +737,6 @@ TerminalDriverBindingStart ( goto ReportError; } - Status = TerminalConOutReset (SimpleTextOutput, FALSE); - if (EFI_ERROR (Status)) { - goto ReportError; - } - - Status = TerminalConOutSetMode (SimpleTextOutput, 0); - if (EFI_ERROR (Status)) { - goto ReportError; - } - - Status = TerminalConOutEnableCursor (SimpleTextOutput, TRUE); - if (EFI_ERROR (Status)) { - goto ReportError; - } - - Status = gBS->CreateEvent ( - EVT_TIMER, - TPL_CALLBACK, - NULL, - NULL, - &TerminalDevice->TwoSecondTimeOut - ); - // // Build the component name for the child device // @@ -850,6 +827,29 @@ TerminalDriverBindingStart ( goto Error; } + Status = TerminalConOutReset (SimpleTextOutput, FALSE); + if (EFI_ERROR (Status)) { + goto ReportError; + } + + Status = TerminalConOutSetMode (SimpleTextOutput, 0); + if (EFI_ERROR (Status)) { + goto ReportError; + } + + Status = TerminalConOutEnableCursor (SimpleTextOutput, TRUE); + if (EFI_ERROR (Status)) { + goto ReportError; + } + + Status = gBS->CreateEvent ( + EVT_TIMER, + TPL_CALLBACK, + NULL, + NULL, + &TerminalDevice->TwoSecondTimeOut + ); + Status = gBS->InstallProtocolInterface ( &TerminalDevice->Handle, &gEfiDevicePathProtocolGuid,