提交 9f4abfa6 编写于 作者: A Andrea Bolognani

conf: Fix error flow in virDomainPCIAddressEnsureAddr()

This avoids setting 'ret' multiple times, which will result
in errors being masked if the first operation fails but the
second one succeeds.

Introduced-by: f183b87f
Spotted-by: Coverity
Reported-by: NJohn Ferlan <jferlan@redhat.com>
Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
Reviewed-by: NPavel Hrdina <phrdina@redhat.com>
上级 b3a3759b
......@@ -940,15 +940,21 @@ virDomainPCIAddressEnsureAddr(virDomainPCIAddressSetPtr addrs,
addrStr, flags, true))
goto cleanup;
ret = virDomainPCIAddressReserveAddrInternal(addrs, &dev->addr.pci,
flags, dev->isolationGroup,
true);
if (virDomainPCIAddressReserveAddrInternal(addrs, &dev->addr.pci,
flags, dev->isolationGroup,
true) < 0) {
goto cleanup;
}
} else {
ret = virDomainPCIAddressReserveNextAddr(addrs, dev, flags, -1);
if (virDomainPCIAddressReserveNextAddr(addrs, dev, flags, -1) < 0)
goto cleanup;
}
dev->addr.pci.extFlags = dev->pciAddrExtFlags;
ret = virDomainPCIAddressExtensionEnsureAddr(addrs, &dev->addr.pci);
if (virDomainPCIAddressExtensionEnsureAddr(addrs, &dev->addr.pci) < 0)
goto cleanup;
ret = 0;
cleanup:
VIR_FREE(addrStr);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册