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....@citrix.com>
---
Cc: Ian Jackson <ian.jack...@eu.citrix.com>
Cc: Wei Liu <wei.l...@citrix.com>
---
 tools/libxc/xc_dom_x86.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c
index e29c666b89..27dad89906 100644
--- a/tools/libxc/xc_dom_x86.c
+++ b/tools/libxc/xc_dom_x86.c
@@ -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++;
 }
 
-- 
2.16.2


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to