提交 84bfb11b 编写于 作者: J John Ferlan

qemu_command: Resolve Coverity DEADCODE

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
上级 ec10ff9e
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册