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

[Xen-devel] [PATCH] libxl: fix unitialized variables in libxl__primary_console_find


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: Olaf Hering <olaf@xxxxxxxxx>
  • Date: Wed, 04 Jul 2012 14:17:44 +0200
  • Delivery-date: Wed, 04 Jul 2012 12:18:08 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

# HG changeset patch
# User Olaf Hering <olaf@xxxxxxxxx>
# Date 1341404234 -7200
# Node ID 5668cb98eebb0a27530c8b52f3ae8cce87d3b863
# Parent  42f76d536b116d2ebad1b6705ae51ecd171d2581
libxl: fix unitialized variables in libxl__primary_console_find

gcc 4.5 as shipped with openSuSE 11.4 does not recognize the case of
LIBXL_DOMAIN_TYPE_INVALID properly:

cc1: warnings being treated as errors
libxl.c: In function 'libxl_primary_console_exec':
libxl.c:1408:14: error: 'domid' may be used uninitialized in this function
libxl.c:1409:9: error: 'cons_num' may be used uninitialized in this function
libxl.c:1410:24: error: 'type' may be used uninitialized in this function
libxl.c: In function 'libxl_primary_console_get_tty':
libxl.c:1421:14: error: 'domid' may be used uninitialized in this function
libxl.c:1422:9: error: 'cons_num' may be used uninitialized in this function
libxl.c:1423:24: error: 'type' may be used uninitialized in this function
make[3]: *** [libxl.o] Error 1

Fix this by adding a default case.

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>

diff -r 42f76d536b11 -r 5668cb98eebb tools/libxl/libxl.c
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -1392,6 +1392,7 @@ static int libxl__primary_console_find(l
             *type = LIBXL_CONSOLE_TYPE_PV;
             break;
         case LIBXL_DOMAIN_TYPE_INVALID:
+        default:
             rc = ERROR_INVAL;
             goto out;
         }

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.