[libvirt] [PATCH] qemu: remove memset params array to zero in qemuDomainGetPercpuStats

the array params is allocated by VIR_ALLOC_N in remoteDispatchDomainGetCPUStats. it had been set to zero. No need to reset it to zero again, and this reset here is incorrect too, nparams * ncpus is the array length not the size of params array. Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com> --- src/qemu/qemu_driver.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index df4f5b5..1e54164 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15818,7 +15818,6 @@ qemuDomainGetPercpuStats(virDomainObjPtr vm, if (virCgroupGetCpuacctPercpuUsage(priv->cgroup, &buf)) goto cleanup; pos = buf; - memset(params, 0, nparams * ncpus); /* return percpu cputime in index 0 */ param_idx = 0; -- 1.8.4.2

On Thu, Jan 23, 2014 at 06:00:18PM +0800, Gao feng wrote:
the array params is allocated by VIR_ALLOC_N in remoteDispatchDomainGetCPUStats. it had been set to zero. No need to reset it to zero again, and this reset here is incorrect too, nparams * ncpus is the array length not the size of params array.
Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com> --- src/qemu/qemu_driver.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index df4f5b5..1e54164 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15818,7 +15818,6 @@ qemuDomainGetPercpuStats(virDomainObjPtr vm, if (virCgroupGetCpuacctPercpuUsage(priv->cgroup, &buf)) goto cleanup; pos = buf; - memset(params, 0, nparams * ncpus);
/* return percpu cputime in index 0 */ param_idx = 0;
ACK Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (2)
-
Daniel P. Berrange
-
Gao feng