]> xenbits.xensource.com Git - xen.git/commitdiff
libxc/x86: do not unconditionally set the module cmdline address
authorRoger Pau Monne <roger.pau@citrix.com>
Wed, 28 Mar 2018 11:55:16 +0000 (12:55 +0100)
committerWei Liu <wei.liu2@citrix.com>
Wed, 28 Mar 2018 12:54:46 +0000 (13:54 +0100)
This will lead to writing a wrong module command line physical memory
address if no command line is actually provided.

This hasn't caused problems so far because hvmloader is the only
consumer of the modules command line, and it's unconditionally set
in that case.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/libxc/xc_dom_x86.c

index f4bacb9e285f5b62a205751d39db22e392062f77..8784d1aa7df5f95937af6c9bbe9b99e63c866944 100644 (file)
@@ -1653,11 +1653,10 @@ static void add_module_to_list(struct xc_dom_image *dom,
                < HVMLOADER_MODULE_CMDLINE_SIZE);
         strncpy(modules_cmdline_start + HVMLOADER_MODULE_CMDLINE_SIZE * index,
                 cmdline, HVMLOADER_MODULE_CMDLINE_SIZE);
+        modlist[index].cmdline_paddr = modules_cmdline_paddr +
+                                       HVMLOADER_MODULE_CMDLINE_SIZE * index;
     }
 
-    modlist[index].cmdline_paddr =
-        modules_cmdline_paddr + HVMLOADER_MODULE_CMDLINE_SIZE * index;
-
     start_info->nr_modules++;
 }