* [PATCH v2] libxl/libxl_dm.c: u.hvm.usbdevice_list is checked for emptiness
@ 2017-05-05 19:02 Robin Lee
2017-05-08 9:54 ` [for-4.9] " Ian Jackson
0 siblings, 1 reply; 4+ messages in thread
From: Robin Lee @ 2017-05-05 19:02 UTC (permalink / raw)
To: Xen-devel; +Cc: Robin Lee, wei.liu2, ian.jackson
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 <robinlee.sysu@gmail.com>
---
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;
}
--
2.9.3
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [for-4.9] Re: [PATCH v2] libxl/libxl_dm.c: u.hvm.usbdevice_list is checked for emptiness
2017-05-05 19:02 [PATCH v2] libxl/libxl_dm.c: u.hvm.usbdevice_list is checked for emptiness Robin Lee
@ 2017-05-08 9:54 ` Ian Jackson
2017-05-08 10:36 ` Julien Grall
0 siblings, 1 reply; 4+ messages in thread
From: Ian Jackson @ 2017-05-08 9:54 UTC (permalink / raw)
To: Robin Lee; +Cc: Julien Grall, wei.liu2, Xen-devel
Robin Lee writes ("[PATCH v2] 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.
>
> This patch will check emptiness of usbdevice_list. And NULL is still a valid empty list.
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Julien, this is a candidate for 4.9. It's a minor bugfix.
Ian.
> 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;
> }
> --
> 2.9.3
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [for-4.9] Re: [PATCH v2] libxl/libxl_dm.c: u.hvm.usbdevice_list is checked for emptiness
2017-05-08 9:54 ` [for-4.9] " Ian Jackson
@ 2017-05-08 10:36 ` Julien Grall
2017-05-08 13:51 ` Ian Jackson
0 siblings, 1 reply; 4+ messages in thread
From: Julien Grall @ 2017-05-08 10:36 UTC (permalink / raw)
To: Ian Jackson, Robin Lee; +Cc: wei.liu2, Xen-devel
Hi Ian,
On 08/05/17 10:54, Ian Jackson wrote:
> Robin Lee writes ("[PATCH v2] 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.
>>
>> This patch will check emptiness of usbdevice_list. And NULL is still a valid empty list.
>
> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
>
> Julien, this is a candidate for 4.9. It's a minor bugfix.
Release-acked-by: Julien Grall <julien.grall@arm.com>
>
> Ian.
>
>> 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;
>> }
>> --
>> 2.9.3
>>
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [for-4.9] Re: [PATCH v2] libxl/libxl_dm.c: u.hvm.usbdevice_list is checked for emptiness
2017-05-08 10:36 ` Julien Grall
@ 2017-05-08 13:51 ` Ian Jackson
0 siblings, 0 replies; 4+ messages in thread
From: Ian Jackson @ 2017-05-08 13:51 UTC (permalink / raw)
To: Julien Grall; +Cc: Robin Lee, wei.liu2, Xen-devel
Julien Grall writes ("Re: [for-4.9] Re: [PATCH v2] libxl/libxl_dm.c: u.hvm.usbdevice_list is checked for emptiness"):
> On 08/05/17 10:54, Ian Jackson wrote:
> > Julien, this is a candidate for 4.9. It's a minor bugfix.
>
> Release-acked-by: Julien Grall <julien.grall@arm.com>
Thanks. Committed.
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-05-08 13:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-05 19:02 [PATCH v2] libxl/libxl_dm.c: u.hvm.usbdevice_list is checked for emptiness Robin Lee
2017-05-08 9:54 ` [for-4.9] " Ian Jackson
2017-05-08 10:36 ` Julien Grall
2017-05-08 13:51 ` Ian Jackson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.