[libvirt] [PATCH 7/9] conf: Add ignore_value to virDomainDeviceInfoIterate calls for Clear helpers

Ján Tomko jtomko at redhat.com
Tue Jul 19 11:07:53 UTC 2016


On Mon, Jul 18, 2016 at 03:06:58PM -0400, John Ferlan wrote:
>Since we don't necessarily care about the status return, just add an
>ignore_value to the calls for virDomainDefClear* calls
>
>Found by Coverity
>
>Signed-off-by: John Ferlan <jferlan at redhat.com>
>---
> src/conf/domain_conf.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
>diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>index 87a9a8d..3cf1f59 100644
>--- a/src/conf/domain_conf.c
>+++ b/src/conf/domain_conf.c
>@@ -4736,17 +4736,17 @@ virDomainDefValidate(virDomainDefPtr def,
>
> void virDomainDefClearPCIAddresses(virDomainDefPtr def)
> {
>-    virDomainDeviceInfoIterate(def, virDomainDeviceInfoClearPCIAddress, NULL);
>+    ignore_value(virDomainDeviceInfoIterate(def, virDomainDeviceInfoClearPCIAddress, NULL));
> }
>
> void virDomainDefClearCCWAddresses(virDomainDefPtr def)
> {
>-    virDomainDeviceInfoIterate(def, virDomainDeviceInfoClearCCWAddress, NULL);
>+    ignore_value(virDomainDeviceInfoIterate(def, virDomainDeviceInfoClearCCWAddress, NULL));
> }

These two are unused since commit fb06350, they can be just removed.

>
> void virDomainDefClearDeviceAliases(virDomainDefPtr def)
> {
>-    virDomainDeviceInfoIterate(def, virDomainDeviceInfoClearAlias, NULL);
>+    ignore_value(virDomainDeviceInfoIterate(def, virDomainDeviceInfoClearAlias, NULL));
> }

The only caller is qemuProcessStop and I think it can also be deleted.

For persistent domains, the domain definition (including aliases) gets
freed a few screens later when we replace it with newDef.

For transient domains, we free the definition along with the
virDomainObj a few moments later, but nothing that cares about
aliases (neither building qemu command line nor talking to it via the
monitor) should be done in the meantime.

Jan




More information about the libvir-list mailing list