mirror of https://github.com/acidanthera/audk.git
ArmPlatformPkg/PlatformIntelBdsLib: don't clobber ConSplitter handle
The InitializeConsolePipe() routine takes care to only set its output argument *Interface if it is not already set, to prevent overwriting the ConSplitter interface pointer that may have already been assigned. However, the associated OUT argument 'Handle' is clobbered by the subsequent unnecessary LocateDevicePath() invocation, which should similarly be made dependent on whether *Interface has been set already. Reported-by: "Lee, Terry Ping-Chung" <terry.lee@hpe.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
This commit is contained in:
parent
f1bbd4e3cc
commit
3858b4a1ff
|
@ -148,12 +148,23 @@ InitializeConsolePipe (
|
|||
|
||||
Status = BdsLibConnectDevicePath (DevicePath);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
|
||||
//
|
||||
// If BdsLibConnectDevicePath () succeeded, *Handle must have a non-NULL
|
||||
// value. So ASSERT that this is the case.
|
||||
// We connect all supplied console device paths, but only return the first
|
||||
// one that connects successfully via *Handle/*Interface. Note that this
|
||||
// may imply that *Handle/*Interface are not updated at all if they have
|
||||
// been connected already, e.g., by the console splitter driver.
|
||||
//
|
||||
gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &DevicePath, Handle);
|
||||
ASSERT (*Handle != NULL);
|
||||
if (*Interface == NULL) {
|
||||
//
|
||||
// If BdsLibConnectDevicePath () succeeded, *Handle must have a non-NULL
|
||||
// value. So ASSERT that this is the case.
|
||||
//
|
||||
gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &DevicePath, Handle);
|
||||
ASSERT (*Handle != NULL);
|
||||
|
||||
gBS->HandleProtocol (*Handle, Protocol, Interface);
|
||||
}
|
||||
}
|
||||
DEBUG_CODE_BEGIN();
|
||||
if (EFI_ERROR(Status)) {
|
||||
|
@ -172,12 +183,6 @@ InitializeConsolePipe (
|
|||
}
|
||||
}
|
||||
DEBUG_CODE_END();
|
||||
|
||||
// If the console splitter driver is not supported by the platform then use the first Device Path
|
||||
// instance for the console interface.
|
||||
if (!EFI_ERROR(Status) && (*Interface == NULL)) {
|
||||
Status = gBS->HandleProtocol (*Handle, Protocol, Interface);
|
||||
}
|
||||
}
|
||||
|
||||
// No Device Path has been defined for this console interface. We take the first protocol implementation
|
||||
|
|
Loading…
Reference in New Issue