|
|
9119d9 |
From 0e09eeb1a38ce91c021b82df59a8e34cc586c35f Mon Sep 17 00:00:00 2001
|
|
|
9119d9 |
Message-Id: <0e09eeb1a38ce91c021b82df59a8e34cc586c35f@dist-git>
|
|
|
9119d9 |
From: Jincheng Miao <jmiao@redhat.com>
|
|
|
9119d9 |
Date: Thu, 30 Oct 2014 07:10:46 +0100
|
|
|
9119d9 |
Subject: [PATCH] remote: fix jump depends on uninitialised value
|
|
|
9119d9 |
|
|
|
9119d9 |
https://bugzilla.redhat.com/show_bug.cgi?id=1158715
|
|
|
9119d9 |
|
|
|
9119d9 |
Currently remote driver only initializes partial fields of
|
|
|
9119d9 |
remote_connect_get_all_domain_stats_args. But xdr_array()
|
|
|
9119d9 |
will check the uninitialised field 'doms_val'.
|
|
|
9119d9 |
For safty reason, memset all fields of args is better.
|
|
|
9119d9 |
|
|
|
9119d9 |
Fix the following error from valgrind, like:
|
|
|
9119d9 |
==30515== 1 errors in context 1 of 3:
|
|
|
9119d9 |
==30515== Conditional jump or move depends on uninitialised value(s)
|
|
|
9119d9 |
==30515== at 0x85E9402: xdr_array (xdr_array.c:88)
|
|
|
9119d9 |
==30515== by 0x4FD8FC9: xdr_remote_connect_get_all_domain_stats_args (remote_protocol.c:6473)
|
|
|
9119d9 |
==30515== by 0x4FE72F2: virNetMessageEncodePayload (virnetmessage.c:350)
|
|
|
9119d9 |
==30515== by 0x4FDD21C: virNetClientProgramCall (virnetclientprogram.c:326)
|
|
|
9119d9 |
==30515== by 0x4FB4D01: callFull.isra.2 (remote_driver.c:6667)
|
|
|
9119d9 |
==30515== by 0x4FCBD45: call (remote_driver.c:6689)
|
|
|
9119d9 |
==30515== by 0x4FCBD45: remoteConnectGetAllDomainStats (remote_driver.c:7793)
|
|
|
9119d9 |
==30515== by 0x4FA0E75: virConnectGetAllDomainStats (libvirt.c:21678)
|
|
|
9119d9 |
==30515== by 0x147FD1: cmdDomstats (virsh-domain-monitor.c:2148)
|
|
|
9119d9 |
==30515== by 0x13006B: vshCommandRun (virsh.c:1915)
|
|
|
9119d9 |
==30515== by 0x12A9E1: main (virsh.c:3699)
|
|
|
9119d9 |
|
|
|
9119d9 |
Signed-off-by: Jincheng Miao <jmiao@redhat.com>
|
|
|
9119d9 |
(cherry picked from commit 28b7601dc7acf99d06277267afb63fff4167b755)
|
|
|
9119d9 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
9119d9 |
---
|
|
|
9119d9 |
src/remote/remote_driver.c | 2 ++
|
|
|
9119d9 |
1 file changed, 2 insertions(+)
|
|
|
9119d9 |
|
|
|
9119d9 |
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
|
|
|
9119d9 |
index 6cf1aae..de021d4 100644
|
|
|
9119d9 |
--- a/src/remote/remote_driver.c
|
|
|
9119d9 |
+++ b/src/remote/remote_driver.c
|
|
|
9119d9 |
@@ -7775,6 +7775,8 @@ remoteConnectGetAllDomainStats(virConnectPtr conn,
|
|
|
9119d9 |
virDomainStatsRecordPtr elem = NULL;
|
|
|
9119d9 |
virDomainStatsRecordPtr *tmpret = NULL;
|
|
|
9119d9 |
|
|
|
9119d9 |
+ memset(&args, 0, sizeof(args));
|
|
|
9119d9 |
+
|
|
|
9119d9 |
if (ndoms) {
|
|
|
9119d9 |
if (VIR_ALLOC_N(args.doms.doms_val, ndoms) < 0)
|
|
|
9119d9 |
goto cleanup;
|
|
|
9119d9 |
--
|
|
|
9119d9 |
2.1.3
|
|
|
9119d9 |
|