[U-Boot] [PATCH v3 01/21] efi: Init the 'rows' and 'cols' variables

Heinrich Schuchardt xypron.glpk at gmx.de
Mon Feb 19 19:21:14 UTC 2018


On 02/19/2018 04:48 PM, Simon Glass wrote:
> The current code causes a compiler error on gcc 4.8.4 as used by sandbox

gcc 4 is legacy. The current version of ggc is 7.3.
The current version of Ubuntu is 17.10.
The commit message should describe the warning produced by gcc.

The patch might quiet a warning but does not get to the point.

In query_console_serial() term_read_reply() might return less than 3 
values. In this case rows and columns is still based on an uninitialized 
value.

Best regards

Heinrich

> on Ubuntu 14.04, which is fairly recent. Init these variables to fix the
> problem.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
> 
> Changes in v3:
> - Add new patch to init the 'rows' and 'cols' variables
> 
> Changes in v2: None
> 
>   lib/efi_loader/efi_console.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
> index 28d63635ec..971e36da48 100644
> --- a/lib/efi_loader/efi_console.c
> +++ b/lib/efi_loader/efi_console.c
> @@ -242,7 +242,7 @@ static efi_status_t EFIAPI efi_cout_query_mode(
>   
>   	if (!console_size_queried) {
>   		const char *stdout_name = env_get("stdout");
> -		int rows, cols;
> +		int rows = 0, cols = 0;
>   
>   		console_size_queried = true;
>   
> 



More information about the U-Boot mailing list