[Qemu-devel] [PATCH] gtk: fix uninitialized variable

Paolo Bonzini posted 1 patch 7 years, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20181003121138.22037-1-pbonzini@redhat.com
Test docker-clang@ubuntu failed
Test checkpatch passed
ui/gtk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[Qemu-devel] [PATCH] gtk: fix uninitialized variable
Posted by Paolo Bonzini 7 years, 4 months ago
zoom_to_fit is never initialized to false, Coverity complains
(not sure why GCC does not).

Fixes: e8b1386ea1719525a1a92df03377764703fe8c64
Cc: kraxel@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 ui/gtk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui/gtk.c b/ui/gtk.c
index 3ddb5fe162..ec935fff90 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -2136,7 +2136,7 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc,
                               QemuConsole *con, int idx,
                               GSList *group, GtkWidget *view_menu)
 {
-    bool zoom_to_fit;
+    bool zoom_to_fit = false;
 
     vc->label = qemu_console_get_label(con);
     vc->s = s;
-- 
2.17.1


Re: [Qemu-devel] [PATCH] gtk: fix uninitialized variable
Posted by Philippe Mathieu-Daudé 7 years, 4 months ago
On 03/10/2018 14:11, Paolo Bonzini wrote:
> zoom_to_fit is never initialized to false, Coverity complains
> (not sure why GCC does not).
> 
> Fixes: e8b1386ea1719525a1a92df03377764703fe8c64
> Cc: kraxel@redhat.com
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  ui/gtk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/ui/gtk.c b/ui/gtk.c
> index 3ddb5fe162..ec935fff90 100644
> --- a/ui/gtk.c
> +++ b/ui/gtk.c
> @@ -2136,7 +2136,7 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc,
>                                QemuConsole *con, int idx,
>                                GSList *group, GtkWidget *view_menu)
>  {
> -    bool zoom_to_fit;
> +    bool zoom_to_fit = false;
>  
>      vc->label = qemu_console_get_label(con);
>      vc->s = s;
>