|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] libxl/libxl_dm.c: u.hvm.usbdevice_list is checked for emptiness
Robin Lee writes ("[PATCH] libxl/libxl_dm.c: u.hvm.usbdevice_list is checked
for emptiness"):
> Currently usbdevice_list is only checked for nullity. But the OCaml binding
> will convert empty list to a pointer to NULL, instead of a NULL pointer. That
> means the OCaml binding will fail to disable USB.
Thanks for this.
> This patch will check emptiness of usbdevice_list. And NULL is still a valid
> empty list.
>
> Signed-off-by: Robin Lee <robinlee.sysu@xxxxxxxxx>
> ---
> tools/libxl/libxl_dm.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
> index f8ba859..a76a438 100644
> --- a/tools/libxl/libxl_dm.c
> +++ b/tools/libxl/libxl_dm.c
> @@ -559,7 +559,7 @@ static int libxl__build_device_model_args_old(libxl__gc
> *gc,
> }
> if (libxl_defbool_val(b_info->u.hvm.usb)
> || b_info->u.hvm.usbdevice
> - || b_info->u.hvm.usbdevice_list) {
> + || libxl_string_list_length(&b_info->u.hvm.usbdevice_list)) {
> if ( b_info->u.hvm.usbdevice && b_info->u.hvm.usbdevice_list )
> {
I think it would be better to add this string_list_length in the
conflict check in the next line. That way if someone (eg in ocaml)
specifies usbdevice but not usbdevice_list it will still work.
> LOGD(ERROR, domid, "Both usbdevice and usbdevice_list set");
> @@ -1149,7 +1149,7 @@ static int libxl__build_device_model_args_new(libxl__gc
> *gc,
> }
> if (libxl_defbool_val(b_info->u.hvm.usb)
> || b_info->u.hvm.usbdevice
> - || b_info->u.hvm.usbdevice_list) {
> + || libxl_string_list_length(&b_info->u.hvm.usbdevice_list)) {
> if ( b_info->u.hvm.usbdevice && b_info->u.hvm.usbdevice_list )
The similarity between the existing code here, and at the previous
site of the bug, is quite striking, isn't it.
Thanks,
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |