]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
libxl: arm: do not create /chosen/bootargs in DTB if no cmdline is specified
authorIan Campbell <ian.campbell@citrix.com>
Wed, 26 Feb 2014 12:13:00 +0000 (12:13 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 14 Mar 2014 14:56:22 +0000 (14:56 +0000)
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@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Cc: george.dunlap@citrix.com>
tools/libxl/libxl_arm.c

index 0a1c8c5f9fd5587ad156ef65e82b26e0f181ee4e..0cfd0cf110f5e21ce465cbc8676aaaac8d5cf61f 100644 (file)
@@ -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;