[libvirt] [PATCH v2] libxl: fix usb inputs loop error
Jim Fehlig
jfehlig at suse.com
Wed Jan 11 14:08:45 UTC 2017
On 01/11/2017 01:16 AM, Cédric Bosdonnat wrote:
> List indexes where mixed up in the code looping over the USB
> input devices.
> ---
> * v2: Increment nusbdevice if LIBXL_HAVE_BUILDINFO_USBDEVICE_LIST is
> not defined.
> src/libxl/libxl_conf.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
> index ac83b51c7..a24f9e052 100644
> --- a/src/libxl/libxl_conf.c
> +++ b/src/libxl/libxl_conf.c
> @@ -479,7 +479,8 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
> if (VIR_EXPAND_N(b_info->u.hvm.usbdevice_list, nusbdevice, 1) < 0)
> return -1;
> #else
> - if (i > 1) {
> + nusbdevice++;
> + if (nusbdevice > 1) {
> virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> _("libxenlight supports only one input device"));
> return -1;
> @@ -487,7 +488,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
>
ACK.
Regards,
Jim
More information about the libvir-list
mailing list