libxl: fix printing hotplug arguments/environment
PATCH 1/1 libxl: fix printing hotplug arguments/environment
A OS could decide to not pass arguments or any environment variables to hotplug scripts, and this will trigger a bug in device_hotplug logic, since it expects both the argument and the environment arrays to exist. Allow both args or env to be NULL.
---
Cc: Wei Liu <[email protected]>
Cc: Ian Jackson <[email protected]>
--- tools/libxl/libxl_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/libxl/libxl_device.c +2 -2
@@ -1132,7 +1132,7 @@ static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev)LOG (DEBUG ,"calling hotplug script: %s %s" , args[0 ], args[1 ]);LOG (DEBUG ,"extra args:" ); - { +if ( args !=NULL ) {const char *arg;unsigned int x;
@@ -1140,7 +1140,7 @@ static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev)LOG (DEBUG ,"\t%s" , arg); }LOG (DEBUG ,"env:" ); - { +if ( env !=NULL ) {const char *k, *v;unsigned int x;
Signature · 7 lines
2.7.4 (Apple Git-66) _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 1 line · Roger Pau Monne
A OS could decide to not pass arguments or any environment variables to
"An"
Quoted 17 lines
hotplug scripts, and this will trigger a bug in
device_hotpluglogic, since it expects both the argument and the environment arrays to exist. Allow both args or env to be NULL.Signed-off-by Roger Pau Monné <[email protected]>---
Cc: Wei Liu <[email protected]>
Cc: Ian Jackson <[email protected]>--- tools/libxl/libxl_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/libxl/libxl_device.c +0
-0
tools/libxl/libxl_device.c static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev) · line 1135
Quoted 5 lines
tools/libxl/libxl_device.c +1
-1@@ -1132,7 +1132,7 @@ static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev)LOG (DEBUG ,"calling hotplug script: %s %s" , args[0 ], args[1 ]);LOG (DEBUG ,"extra args:" ); - { +if ( args !=NULL ) {
Minor nit, extraneous space here.
Shouldn't this check be moved before the "calling hotplug script..." line?
Quoted 15 lines
tools/libxl/libxl_device.c +1
-1const char *arg;unsigned int x;@@ -1140,7 +1140,7 @@ static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev)LOG (DEBUG ,"\t%s" , arg); }LOG (DEBUG ,"env:" ); - { +if ( env !=NULL ) {const char *k, *v;unsigned int x;Signature · 1 line
2.7.4 (Apple Git-66)
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 30 lines · Wei Liu
Quoted 1 line · Roger Pau Monne
A OS could decide to not pass arguments or any environment variables to
"An"
Quoted 17 lines
hotplug scripts, and this will trigger a bug in
device_hotpluglogic, since it expects both the argument and the environment arrays to exist. Allow both args or env to be NULL.Signed-off-by Roger Pau Monné <[email protected]>---
Cc: Wei Liu <[email protected]>
Cc: Ian Jackson <[email protected]>--- tools/libxl/libxl_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/libxl/libxl_device.c +0
-0tools/libxl/libxl_device.c static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev) · line 1135
Quoted 5 lines
tools/libxl/libxl_device.c +1
-1@@ -1132,7 +1132,7 @@ static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev)LOG (DEBUG ,"calling hotplug script: %s %s" , args[0 ], args[1 ]);LOG (DEBUG ,"extra args:" ); - { +if ( args !=NULL ) {Minor nit, extraneous space here.
Quoted 2 lines
Shouldn't this check be moved before the "calling hotplug script..." line?
This one should be removed, args cannot be NULL or else we won't call anything, and thus libxl__get_hotplug_script_info should return 0.
Quoted 12 lines
Quoted 12 lines
tools/libxl/libxl_device.c +1
-1const char *arg;unsigned int x;@@ -1140,7 +1140,7 @@ static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev)LOG (DEBUG ,"\t%s" , arg); }LOG (DEBUG ,"env:" ); - { +if ( env !=NULL ) {const char *k, *v;unsigned int x;
Quoted 3 lines
Quoted 3 lines
Signature · 1 line
2.7.4 (Apple Git-66)
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 31 lines · Roger Pau Monne
Quoted 30 lines · Wei Liu
Quoted 1 line · Roger Pau Monne
A OS could decide to not pass arguments or any environment variables to
"An"
Quoted 17 lines
hotplug scripts, and this will trigger a bug in
device_hotpluglogic, since it expects both the argument and the environment arrays to exist. Allow both args or env to be NULL.Signed-off-by Roger Pau Monné <[email protected]>---
Cc: Wei Liu <[email protected]>
Cc: Ian Jackson <[email protected]>--- tools/libxl/libxl_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/libxl/libxl_device.c +0
-0tools/libxl/libxl_device.c static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev) · line 1135
Quoted 5 lines
tools/libxl/libxl_device.c +1
-1@@ -1132,7 +1132,7 @@ static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev)LOG (DEBUG ,"calling hotplug script: %s %s" , args[0 ], args[1 ]);LOG (DEBUG ,"extra args:" ); - { +if ( args !=NULL ) {Minor nit, extraneous space here.
Quoted 6 lines
Quoted 2 lines
Shouldn't this check be moved before the "calling hotplug script..." line?
This one should be removed, args cannot be NULL or else we won't call anything, and thus
libxl__get_hotplug_script_infoshould return 0.
OK, please update the patch commit message and content.
I will wait for v2.
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
tools/libxl/libxl_device.c +1
-1const char *arg;unsigned int x;@@ -1140,7 +1140,7 @@ static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev)LOG (DEBUG ,"\t%s" , arg); }LOG (DEBUG ,"env:" ); - { +if ( env !=NULL ) {const char *k, *v;unsigned int x;
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Signature · 1 line
2.7.4 (Apple Git-66)
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Pushed.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel