]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
cmdFreepages: initialize @tmp
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 23 Jun 2014 18:25:22 +0000 (20:25 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 23 Jun 2014 18:25:22 +0000 (20:25 +0200)
In the 404bac14 the @tmp variable was introduced. It's purpose is to
avoid typecasting when parsing --pagesize argument. However, if the
argument is not presented, tmp may be used uninitialized resulting in
bogus virNodeGetFreePages() API call:

virsh freepages --cellno 2
error: Failed to open file '/sys/devices/system/node/node2/hugepages/hugepages-4294967295kB/free_hugepages': No such file or directory

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
tools/virsh-host.c

index 13d4c5ce1f10957321b8ea8d53c740414a27a01d..734f1a8503c2f6ac3b17508d7c07e53df6a62dcf 100644 (file)
@@ -229,7 +229,7 @@ cmdFreepages(vshControl *ctl, const vshCmd *cmd)
     bool ret = false;
     unsigned int npages;
     unsigned int *pagesize = NULL;
-    unsigned long long tmp;
+    unsigned long long tmp = 0;
     int cell;
     unsigned long long *counts = NULL;
     size_t i, j;