On Thu, Jul 11, 2013 at 08:34:07AM -0400, John Ferlan wrote:
> 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.
> ---
> src/qemu/qemu_hostdev.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
> index 9bdace1..970d099 100644
> --- a/src/qemu/qemu_hostdev.c
> +++ b/src/qemu/qemu_hostdev.c
> @@ -644,11 +644,13 @@ inactivedevs:
> }
>
> resetvfnetconfig:
> - for (i = 0; i < last_processed_hostdev_vf; i++) {
> - virDomainHostdevDefPtr hostdev = hostdevs[i];
> - if (hostdev->parent.type == VIR_DOMAIN_DEVICE_NET &&
> - hostdev->parent.data.net) {
> - qemuDomainHostdevNetConfigRestore(hostdev, cfg->stateDir);
> + if (last_processed_hostdev_vf >= 0) {
> + for (i = 0; i < last_processed_hostdev_vf; i++) {
> + virDomainHostdevDefPtr hostdev = hostdevs[i];
> + if (hostdev->parent.type == VIR_DOMAIN_DEVICE_NET &&
> + hostdev->parent.data.net) {
> + qemuDomainHostdevNetConfigRestore(hostdev, cfg->stateDir);
> + }
> }
> }
Slight preference for just changing the termination condition
in the for() loop to include "last_processed_hostdev_vf != -1"
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list