]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
flatload: fix bss clearing
authorMike Frysinger <vapier@gentoo.org>
Mon, 9 Jul 2012 03:04:57 +0000 (03:04 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 14 Aug 2012 19:26:55 +0000 (20:26 +0100)
The current bss clear logic assumes the target mmap address and host
address are the same.  Use g2h to translate from the target address
space to the host so we can call memset on it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
linux-user/flatload.c

index be794960ccc12e3948c37721facdc415aeb4d21e..58f679e07282acacde4c9ec20eec6c56d79e2b1b 100644 (file)
@@ -660,7 +660,7 @@ static int load_flat_file(struct linux_binprm * bprm,
     }
 
     /* zero the BSS.  */
-    memset((void *)((unsigned long)datapos + data_len), 0, bss_len);
+    memset(g2h(datapos + data_len), 0, bss_len);
 
     return 0;
 }