* [PATCH] libxl: fix printing hotplug arguments/environment
@ 2016-08-01 16:20 Roger Pau Monne
2016-08-02 9:13 ` Wei Liu
2016-08-02 16:03 ` Wei Liu
0 siblings, 2 replies; 5+ messages in thread
From: Roger Pau Monne @ 2016-08-01 16:20 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Jackson, Wei Liu, Roger Pau Monne
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.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
---
tools/libxl/libxl_device.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index b9a6df2..0e5f546 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -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;
--
2.7.4 (Apple Git-66)
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] libxl: fix printing hotplug arguments/environment
2016-08-01 16:20 [PATCH] libxl: fix printing hotplug arguments/environment Roger Pau Monne
@ 2016-08-02 9:13 ` Wei Liu
2016-08-02 9:27 ` Roger Pau Monne
2016-08-02 16:03 ` Wei Liu
1 sibling, 1 reply; 5+ messages in thread
From: Wei Liu @ 2016-08-02 9:13 UTC (permalink / raw)
To: Roger Pau Monne; +Cc: xen-devel, Wei Liu, Ian Jackson
On Mon, Aug 01, 2016 at 06:20:56PM +0200, Roger Pau Monne wrote:
> A OS could decide to not pass arguments or any environment variables to
"An"
> 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.
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> ---
> Cc: Wei Liu <wei.liu2@citrix.com>
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> ---
> tools/libxl/libxl_device.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
> index b9a6df2..0e5f546 100644
> --- a/tools/libxl/libxl_device.c
> +++ b/tools/libxl/libxl_device.c
> @@ -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?
> 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;
>
> --
> 2.7.4 (Apple Git-66)
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] libxl: fix printing hotplug arguments/environment
2016-08-02 9:13 ` Wei Liu
@ 2016-08-02 9:27 ` Roger Pau Monne
2016-08-02 9:31 ` Wei Liu
0 siblings, 1 reply; 5+ messages in thread
From: Roger Pau Monne @ 2016-08-02 9:27 UTC (permalink / raw)
To: Wei Liu; +Cc: xen-devel, Ian Jackson
On Tue, Aug 02, 2016 at 10:13:42AM +0100, Wei Liu wrote:
> On Mon, Aug 01, 2016 at 06:20:56PM +0200, Roger Pau Monne wrote:
> > A OS could decide to not pass arguments or any environment variables to
>
> "An"
>
> > 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.
> >
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> > ---
> > Cc: Wei Liu <wei.liu2@citrix.com>
> > Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> > ---
> > tools/libxl/libxl_device.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
> > index b9a6df2..0e5f546 100644
> > --- a/tools/libxl/libxl_device.c
> > +++ b/tools/libxl/libxl_device.c
> > @@ -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?
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.
> > 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;
> >
> > --
> > 2.7.4 (Apple Git-66)
> >
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] libxl: fix printing hotplug arguments/environment
2016-08-02 9:27 ` Roger Pau Monne
@ 2016-08-02 9:31 ` Wei Liu
0 siblings, 0 replies; 5+ messages in thread
From: Wei Liu @ 2016-08-02 9:31 UTC (permalink / raw)
To: Roger Pau Monne; +Cc: xen-devel, Wei Liu, Ian Jackson
On Tue, Aug 02, 2016 at 11:27:13AM +0200, Roger Pau Monne wrote:
> On Tue, Aug 02, 2016 at 10:13:42AM +0100, Wei Liu wrote:
> > On Mon, Aug 01, 2016 at 06:20:56PM +0200, Roger Pau Monne wrote:
> > > A OS could decide to not pass arguments or any environment variables to
> >
> > "An"
> >
> > > 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.
> > >
> > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> > > ---
> > > Cc: Wei Liu <wei.liu2@citrix.com>
> > > Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> > > ---
> > > tools/libxl/libxl_device.c | 4 ++--
> > > 1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
> > > index b9a6df2..0e5f546 100644
> > > --- a/tools/libxl/libxl_device.c
> > > +++ b/tools/libxl/libxl_device.c
> > > @@ -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?
>
> 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.
>
OK, please update the patch commit message and content.
I will wait for v2.
> > > 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;
> > >
> > > --
> > > 2.7.4 (Apple Git-66)
> > >
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] libxl: fix printing hotplug arguments/environment
2016-08-01 16:20 [PATCH] libxl: fix printing hotplug arguments/environment Roger Pau Monne
2016-08-02 9:13 ` Wei Liu
@ 2016-08-02 16:03 ` Wei Liu
1 sibling, 0 replies; 5+ messages in thread
From: Wei Liu @ 2016-08-02 16:03 UTC (permalink / raw)
To: Roger Pau Monne; +Cc: xen-devel, Wei Liu, Ian Jackson
Pushed.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-08-02 16:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-01 16:20 [PATCH] libxl: fix printing hotplug arguments/environment Roger Pau Monne
2016-08-02 9:13 ` Wei Liu
2016-08-02 9:27 ` Roger Pau Monne
2016-08-02 9:31 ` Wei Liu
2016-08-02 16:03 ` Wei Liu
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.