One useless warning, but the other one rather pertinent. On entry
the 'trans' variable is initialized to VIR_DOMAIN_DISK_TRANS_DEFAULT.
When the "trans" was found in the parsing loop it def->geometry.trans
was assigned to the return from virDomainDiskGeometryTransTypeFromString
and then 'trans' was used to do the comparison to see if it was valid.
So remove 'trans' and use def->geometry.trans properly
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/qemu/qemu_command.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 528f947..bf6285f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6237,6 +6237,7 @@ qemuBuildCpuArgStr(virQEMUDriverPtr driver,
def->hyperv_spinlocks);
break;
+ /* coverity[dead_error_begin] */
case VIR_DOMAIN_HYPERV_LAST:
break;
}
@@ -9835,7 +9836,6 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
int idx = -1;
int busid = -1;
int unitid = -1;
- int trans = VIR_DOMAIN_DISK_TRANS_DEFAULT;
if (qemuParseKeywords(val,
&keywords,
@@ -10054,12 +10054,12 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
} else if (STREQ(keywords[i], "trans")) {
def->geometry.trans =
virDomainDiskGeometryTransTypeFromString(values[i]);
- if ((trans < VIR_DOMAIN_DISK_TRANS_DEFAULT) ||
- (trans >= VIR_DOMAIN_DISK_TRANS_LAST)) {
+ if ((def->geometry.trans < VIR_DOMAIN_DISK_TRANS_DEFAULT) ||
+ (def->geometry.trans >= VIR_DOMAIN_DISK_TRANS_LAST)) {
virDomainDiskDefFree(def);
def = NULL;
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("cannot parse translation
value'%s'"),
+ _("cannot parse translation value
'%s'"),
values[i]);
goto error;
}
--
1.9.3