On 01/15/2015 02:14 PM, Erik Skultety wrote:
We tested for positive return value from virDomainMaybeAddController, but it returns 0 or -1 only resulting in a dead code. ---
If it returns < 0, we've already jumped to cleanup, thus the condition is always true here. The proper fix would be to return 0 in virDomainMaybeAddController if the bridge is already present and return 1 if it was newly added. But even as-is, the only downside is that we'll possibly generate more bridges than needed, which only should be a problem when we get to the limit (~256 I think). Jan
src/qemu/qemu_command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 06def5f..1671e11 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1509,7 +1509,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def, i, bus->model)) < 0) goto cleanup; /* If we added a new bridge, we will need one more address */ - if (rv > 0 && virDomainPCIAddressReserveNextSlot(addrs, &info, + if (rv == 0 && virDomainPCIAddressReserveNextSlot(addrs, &info, flags) < 0) goto cleanup; }