From: Roger Pau Monne Date: Tue, 2 Aug 2016 10:49:51 +0000 (+0200) Subject: libxl: fix printing hotplug arguments/environment X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~647 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=25131cea72bfe8ce25cadc689df34e7e8b1596f9;p=xen.git libxl: fix printing hotplug arguments/environment 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é Acked-by: Wei Liu --- diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c index b9a6df2810..dbf157d469 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;