qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCHv2] curses ui: always initialize all curses_line


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-devel] [PATCHv2] curses ui: always initialize all curses_line fields
Date: Fri, 15 Mar 2019 17:15:34 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1

On 3/15/19 2:09 PM, Samuel Thibault wrote:
> cchar_t can contain not only attr and chars fields, but also ext_color.
> Initialize the whole structure to zero instead of enumerating fields.
> 
> Spotted by Coverity: CID 1399711
> 
> Signed-off-by: Samuel Thibault <address@hidden>
> ---
>  ui/curses.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/ui/curses.c b/ui/curses.c
> index d29098db9f..cc6d6da684 100644
> --- a/ui/curses.c
> +++ b/ui/curses.c
> @@ -75,9 +75,9 @@ static void curses_update(DisplayChangeListener *dcl,
>              if (vga_to_curses[ch].chars[0]) {
>                  curses_line[x] = vga_to_curses[ch];
>              } else {
> -                curses_line[x].chars[0] = ch;
> -                curses_line[x].chars[1] = 0;
> -                curses_line[x].attr = 0;
> +                curses_line[x] = (cchar_t) {
> +                    .chars[0] = ch,
> +                };
>              }
>              curses_line[x].attr |= at;
>          }
> 

Reviewed-by: Philippe Mathieu-Daudé <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]