mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: silence coverity warnings
Coverity warns if the majority of callers check a function for errors, but a few don't; but in qemu_audit and qemu_domain, the choice to not check for failures was safe. In qemu_command, the failure to generate a uuid can only occur on a bad pointer. * src/qemu/qemu_audit.c (qemuAuditCgroup): Ignore failure to get cgroup controller. * src/qemu/qemu_domain.c (qemuDomainObjEnterMonitor) (qemuDomainObjEnterMonitorWithDriver): Ignore failure to get timestamp. * src/qemu/qemu_command.c (qemuParseCommandLine): Check for error.
This commit is contained in:
parent
6e07f72ee5
commit
aaea56dc99
@ -31,6 +31,7 @@
|
|||||||
#include "uuid.h"
|
#include "uuid.h"
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
#include "ignore-value.h"
|
||||||
|
|
||||||
/* Return nn:mm in hex for block and character devices, and NULL
|
/* Return nn:mm in hex for block and character devices, and NULL
|
||||||
* for other file types, stat failure, or allocation failure. */
|
* for other file types, stat failure, or allocation failure. */
|
||||||
@ -264,8 +265,9 @@ qemuAuditCgroup(virDomainObjPtr vm, virCgroupPtr cgroup,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
virCgroupPathOfController(cgroup, VIR_CGROUP_CONTROLLER_DEVICES,
|
ignore_value(virCgroupPathOfController(cgroup,
|
||||||
NULL, &controller);
|
VIR_CGROUP_CONTROLLER_DEVICES,
|
||||||
|
NULL, &controller));
|
||||||
detail = virAuditEncode("cgroup", VIR_AUDIT_STR(controller));
|
detail = virAuditEncode("cgroup", VIR_AUDIT_STR(controller));
|
||||||
|
|
||||||
VIR_AUDIT(VIR_AUDIT_RECORD_RESOURCE, success,
|
VIR_AUDIT(VIR_AUDIT_RECORD_RESOURCE, success,
|
||||||
|
@ -5842,7 +5842,11 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
|
|||||||
if (VIR_ALLOC(cmd) < 0)
|
if (VIR_ALLOC(cmd) < 0)
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
|
|
||||||
virUUIDGenerate(def->uuid);
|
if (virUUIDGenerate(def->uuid) < 0) {
|
||||||
|
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
|
_("failed to generate uuid"));
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
def->id = -1;
|
def->id = -1;
|
||||||
def->mem.cur_balloon = def->mem.max_balloon = 64 * 1024;
|
def->mem.cur_balloon = def->mem.max_balloon = 64 * 1024;
|
||||||
|
@ -608,7 +608,7 @@ void qemuDomainObjEnterMonitor(virDomainObjPtr obj)
|
|||||||
|
|
||||||
qemuMonitorLock(priv->mon);
|
qemuMonitorLock(priv->mon);
|
||||||
qemuMonitorRef(priv->mon);
|
qemuMonitorRef(priv->mon);
|
||||||
virTimeMs(&priv->monStart);
|
ignore_value(virTimeMs(&priv->monStart));
|
||||||
virDomainObjUnlock(obj);
|
virDomainObjUnlock(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -651,7 +651,7 @@ void qemuDomainObjEnterMonitorWithDriver(struct qemud_driver *driver,
|
|||||||
|
|
||||||
qemuMonitorLock(priv->mon);
|
qemuMonitorLock(priv->mon);
|
||||||
qemuMonitorRef(priv->mon);
|
qemuMonitorRef(priv->mon);
|
||||||
virTimeMs(&priv->monStart);
|
ignore_value(virTimeMs(&priv->monStart));
|
||||||
virDomainObjUnlock(obj);
|
virDomainObjUnlock(obj);
|
||||||
qemuDriverUnlock(driver);
|
qemuDriverUnlock(driver);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user