From 8d8e1d9dbc8aaf6cc7205835cdf2ee7ac549b8e7 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Mon, 23 Jun 2014 20:25:22 +0200 Subject: [PATCH] cmdFreepages: initialize @tmp 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 --- tools/virsh-host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 13d4c5ce1f..734f1a8503 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -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;