From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Ian Jackson <ian.jackson@eu.citrix.com>,
Wei Liu <wei.liu2@citrix.com>,
Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH v2] libxl: fix printing hotplug arguments/environment
Date: Tue, 2 Aug 2016 12:49:51 +0200 [thread overview]
Message-ID: <1470134991-17569-1-git-send-email-roger.pau@citrix.com> (raw)
An OS could decide to not pass any environment variables to hotplug scripts,
and this will trigger a bug in device_hotplug logic, since it expects the
environment array to exist. Allow 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>
---
Changes since v1:
- Fix commit message
- Only allow env to be NULL.
---
tools/libxl/libxl_device.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index b9a6df2..dbf157d 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -1130,6 +1130,7 @@ static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev)
goto out;
}
+ assert(args != NULL);
LOG(DEBUG, "calling hotplug script: %s %s", args[0], args[1]);
LOG(DEBUG, "extra args:");
{
@@ -1140,7 +1141,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
next reply other threads:[~2016-08-02 10:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-02 10:49 Roger Pau Monne [this message]
2016-08-02 10:51 ` [PATCH v2] libxl: fix printing hotplug arguments/environment Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1470134991-17569-1-git-send-email-roger.pau@citrix.com \
--to=roger.pau@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).