render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
9119d9
From 25e86fba1910cccd107b66a23a0d5a71ae3e2621 Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <25e86fba1910cccd107b66a23a0d5a71ae3e2621@dist-git>
9119d9
From: John Ferlan <jferlan@redhat.com>
9119d9
Date: Mon, 15 Sep 2014 15:13:47 -0400
9119d9
Subject: [PATCH] qemu_driver: Resolve Coverity COPY_PASTE_ERROR
9119d9
9119d9
https://bugzilla.redhat.com/show_bug.cgi?id=1141209
9119d9
9119d9
In qemuDomainSetBlkioParameters(), Coverity points out that the calls
9119d9
to qemuDomainParseBlkioDeviceStr() are slightly different and points
9119d9
out there may be a cut-n-paste error.
9119d9
9119d9
In the first call (AFFECT_LIVE), the second parameter is "param->field";
9119d9
however, for the second call (AFFECT_CONFIG), the second parameter is
9119d9
"params->field".  It seems the "param->field" is correct especially since
9119d9
each path as a setting of "param" to "&params[i]".  Furthermore, there
9119d9
were a few more instances of using "params[i]" instead of "param->"
9119d9
which I cleaned up.
9119d9
9119d9
Signed-off-by: John Ferlan <jferlan@redhat.com>
9119d9
(cherry picked from commit f72f064269ea599bc0e67787e2c69f98e524fa56)
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 src/qemu/qemu_driver.c | 10 +++++-----
9119d9
 1 file changed, 5 insertions(+), 5 deletions(-)
9119d9
9119d9
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
9119d9
index 496fab5..04384fb 100644
9119d9
--- a/src/qemu/qemu_driver.c
9119d9
+++ b/src/qemu/qemu_driver.c
9119d9
@@ -7831,7 +7831,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
9119d9
             virTypedParameterPtr param = &params[i];
9119d9
 
9119d9
             if (STREQ(param->field, VIR_DOMAIN_BLKIO_WEIGHT)) {
9119d9
-                if (virCgroupSetBlkioWeight(priv->cgroup, params[i].value.ui) < 0)
9119d9
+                if (virCgroupSetBlkioWeight(priv->cgroup, param->value.ui) < 0)
9119d9
                     ret = -1;
9119d9
             } else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WEIGHT) ||
9119d9
                        STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_READ_IOPS) ||
9119d9
@@ -7842,7 +7842,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
9119d9
                 virBlkioDevicePtr devices = NULL;
9119d9
                 size_t j;
9119d9
 
9119d9
-                if (qemuDomainParseBlkioDeviceStr(params[i].value.s,
9119d9
+                if (qemuDomainParseBlkioDeviceStr(param->value.s,
9119d9
                                                   param->field,
9119d9
                                                   &devices,
9119d9
                                                   &ndevices) < 0) {
9119d9
@@ -7925,7 +7925,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
9119d9
             virTypedParameterPtr param = &params[i];
9119d9
 
9119d9
             if (STREQ(param->field, VIR_DOMAIN_BLKIO_WEIGHT)) {
9119d9
-                persistentDef->blkio.weight = params[i].value.ui;
9119d9
+                persistentDef->blkio.weight = param->value.ui;
9119d9
             } else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WEIGHT) ||
9119d9
                        STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_READ_IOPS) ||
9119d9
                        STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WRITE_IOPS) ||
9119d9
@@ -7934,8 +7934,8 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
9119d9
                 virBlkioDevicePtr devices = NULL;
9119d9
                 size_t ndevices;
9119d9
 
9119d9
-                if (qemuDomainParseBlkioDeviceStr(params[i].value.s,
9119d9
-                                                  params->field,
9119d9
+                if (qemuDomainParseBlkioDeviceStr(param->value.s,
9119d9
+                                                  param->field,
9119d9
                                                   &devices,
9119d9
                                                   &ndevices) < 0) {
9119d9
                     ret = -1;
9119d9
-- 
9119d9
2.1.0
9119d9