Re: [PATCH] libxl: fix usb inputs loop error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Cédric Bosdonnat wrote:
> List indexes where mixed up in the code looping over the USB
> input devices.
> ---
>  src/libxl/libxl_conf.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
> index ac83b51c7..1053e60a1 100644
> --- a/src/libxl/libxl_conf.c
> +++ b/src/libxl/libxl_conf.c
> @@ -479,7 +479,7 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
>              if (VIR_EXPAND_N(b_info->u.hvm.usbdevice_list, nusbdevice, 1) < 0)
>                  return -1;
>  #else
> -            if (i > 1) {
> +            if (nusbdevice > 1) {

IIUC, when LIBXL_HAVE_BUILDINFO_USBDEVICE_LIST is not defined nusbdevice will
always be 0. I think we need to increment it before the > 1 check.

Regards,
Jim

>                  virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
>                          _("libxenlight supports only one input device"));
>                  return -1;
> @@ -487,7 +487,7 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
>  #endif
>  
>  #ifdef LIBXL_HAVE_BUILDINFO_USBDEVICE_LIST
> -            usbdevice = &b_info->u.hvm.usbdevice_list[i];
> +            usbdevice = &b_info->u.hvm.usbdevice_list[nusbdevice - 1];
>  #else
>              usbdevice = &b_info->u.hvm.usbdevice;
>  #endif

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux