From patchwork Tue Aug 14 09:40:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [07/10] flatload: fix bss clearing From: Peter Maydell X-Patchwork-Id: 177204 Message-Id: <1344937236-611-8-git-send-email-peter.maydell@linaro.org> To: Anthony Liguori , Blue Swirl Cc: Riku Voipio , qemu-devel@nongnu.org Date: Tue, 14 Aug 2012 10:40:33 +0100 From: Mike Frysinger 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 Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- linux-user/flatload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/flatload.c b/linux-user/flatload.c index be79496..58f679e 100644 --- a/linux-user/flatload.c +++ b/linux-user/flatload.c @@ -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; }