[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] libxl: arm: do not create /chosen/bootargs in DTB if no cmdline is specified



Otherwise we deference a NULL pointer.

I saw this while experimenting with libvirt on Xen on ARM, xl already checks
that the command line is non NULL and provides "" as a default.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: george.dunlap@xxxxxxxxxx>
---
This is a pretty obvious fix and would be nice to have if we are taking any
more fixes for other stuff , but otherwise I think we can leave to 4.4.1 quite
happily.
---
 tools/libxl/libxl_arm.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index 0a1c8c5..0cfd0cf 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -164,8 +164,10 @@ static int make_chosen_node(libxl__gc *gc, void *fdt,
     res = fdt_begin_node(fdt, "chosen");
     if (res) return res;
 
-    res = fdt_property_string(fdt, "bootargs", info->u.pv.cmdline);
-    if (res) return res;
+    if (info->u.pv.cmdline) {
+        res = fdt_property_string(fdt, "bootargs", info->u.pv.cmdline);
+        if (res) return res;
+    }
 
     res = fdt_end_node(fdt);
     if (res) return res;
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.