Quantcast

[xen master] libxl: u.hvm.usbdevice_list is checked for emptiness

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[xen master] libxl: u.hvm.usbdevice_list is checked for emptiness

patchbot
commit 03350f1ce7398a5b2d54802efe21659bd8d03772
Author:     Robin Lee <[hidden email]>
AuthorDate: Sat May 6 03:02:32 2017 +0800
Commit:     Ian Jackson <[hidden email]>
CommitDate: Mon May 8 14:45:03 2017 +0100

    libxl: 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.
   
    This patch will check emptiness of usbdevice_list. And NULL is still a
    valid empty list.
   
    Signed-off-by: Robin Lee <[hidden email]>
    Acked-by: Ian Jackson <[hidden email]>
    Release-acked-by: Julien Grall <[hidden email]>
---
 tools/libxl/libxl_dm.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index f8ba859..44ebd70 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -559,9 +559,9 @@ 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) {
-            if ( 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
+                && libxl_string_list_length(&b_info->u.hvm.usbdevice_list)) {
                 LOGD(ERROR, domid, "Both usbdevice and usbdevice_list set");
                 return ERROR_INVAL;
             }
@@ -1149,9 +1149,9 @@ 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) {
-            if ( 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
+                && libxl_string_list_length(&b_info->u.hvm.usbdevice_list)) {
                 LOGD(ERROR, guest_domid, "Both usbdevice and usbdevice_list set");
                 return ERROR_INVAL;
             }
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog
Loading...