mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
qemu_hostdev: Resolve Coverity issue
Recent changes uncovered a possibility that 'last_processed_hostdev_vf' was set to -1 in 'qemuPrepareHostdevPCIDevices' and would cause problems in for loop end condition in the 'resetvfnetconfig' label if the variable was never set to 'i' due to 'qemuDomainHostdevNetConfigReplace' failure.
This commit is contained in:
parent
ba3427a019
commit
a5fcea5513
@ -644,7 +644,8 @@ inactivedevs:
|
||||
}
|
||||
|
||||
resetvfnetconfig:
|
||||
for (i = 0; i < last_processed_hostdev_vf; i++) {
|
||||
for (i = 0; last_processed_hostdev_vf != -1 &&
|
||||
i < last_processed_hostdev_vf; i++) {
|
||||
virDomainHostdevDefPtr hostdev = hostdevs[i];
|
||||
if (hostdev->parent.type == VIR_DOMAIN_DEVICE_NET &&
|
||||
hostdev->parent.data.net) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user