Skip to content

Commit

Permalink
flatload: fix bss clearing
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
vapier authored and pm215 committed Aug 14, 2012
1 parent aebf5bc commit cd8e407
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion linux-user/flatload.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit cd8e407

Please sign in to comment.