Reviewed-by: Michael Kinney
> -Original Message-
> From: Zeng, Star
> Sent: Tuesday, November 24, 2015 5:34 PM
> To: edk2-devel@lists.01.org
> Cc: Kinney, Michael D ; Gao, Liming
> ; Tian, Feng ; Laszlo
> Ersek
> Subject: [PATCH V4 01/13] MdeModulePkg: TerminalDxe: avoid checking
> uninitialized variable
>
> The SerialIo->GetControl() function is not required to set the
> Control output parameter on error. Make sure we apply the
> EFI_SERIAL_INPUT_BUFFER_EMPTY optimization in
> TerminalConInTimerHandler() only if the SerialIo->GetControl()
> function call set that bit in the Control variable.
>
> Cc: Michael D Kinney
> Cc: Liming Gao
> Cc: Feng Tian
> Cc: Laszlo Ersek
> Contributed-under: TianoCore Contribution Agreement 1.0
> Suggested-by: Laszlo Ersek
> Signed-off-by: Star Zeng
> ---
> MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c | 7 ---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
> b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
> index c216ed9..3be877b 100644
> --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
> +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
> @@ -2,7 +2,7 @@
>Implementation for EFI_SIMPLE_TEXT_INPUT_PROTOCOL protocol.
>
> (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
> -Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
> This program and the accompanying materials
> are licensed and made available under the terms and conditions of the BSD
> License
> which accompanies this distribution. The full text of the license may be
> found at
> @@ -562,10 +562,11 @@ TerminalConInTimerHandler (
>}
>//
>// Check whether serial buffer is empty.
> + // Skip the key transfer loop only if the SerialIo protocol instance
> + // successfully reports EFI_SERIAL_INPUT_BUFFER_EMPTY.
>//
>Status = SerialIo->GetControl (SerialIo, &Control);
> -
> - if ((Control & EFI_SERIAL_INPUT_BUFFER_EMPTY) == 0) {
> + if (EFI_ERROR (Status) || ((Control & EFI_SERIAL_INPUT_BUFFER_EMPTY) ==
> 0)) {
> //
> // Fetch all the keys in the serial buffer,
> // and insert the byte stream into RawFIFO.
> --
> 1.9.5.msysgit.0
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel