summaryrefslogtreecommitdiffstats
path: root/fs/binfmt_flat.c
diff options
context:
space:
mode:
authorNicolas Pitre <nicolas.pitre@linaro.org>2016-07-24 11:30:23 -0400
committerGreg Ungerer <gerg@linux-m68k.org>2016-07-27 23:29:11 -0400
commit467aa1465a7b9f0bd1a23c83bff8c38e3c3e660e (patch)
treee5e478b273192a601f81bee6a8d3f78116cdffb9 /fs/binfmt_flat.c
parent1b2ce442ea96b1e76300553963154d68cc5b4ad0 (diff)
binfmt_flat: use clear_user() rather than memset() to clear .bss
This is needed on systems with a MMU. Signed-off-by: Nicolas Pitre <nico@linaro.org> Reviewed-by: Greg Ungerer <gerg@linux-m68k.org> Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
Diffstat (limited to 'fs/binfmt_flat.c')
-rw-r--r--fs/binfmt_flat.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index 8e812d7a62e0..eb747a266537 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -795,10 +795,11 @@ static int load_flat_file(struct linux_binprm *bprm,
795 flush_icache_range(start_code, end_code); 795 flush_icache_range(start_code, end_code);
796 796
797 /* zero the BSS, BRK and stack areas */ 797 /* zero the BSS, BRK and stack areas */
798 memset((void *)(datapos + data_len), 0, bss_len + 798 if (clear_user((void __user *)(datapos + data_len), bss_len +
799 (memp + memp_size - stack_len - /* end brk */ 799 (memp + memp_size - stack_len - /* end brk */
800 libinfo->lib_list[id].start_brk) + /* start brk */ 800 libinfo->lib_list[id].start_brk) + /* start brk */
801 stack_len); 801 stack_len))
802 return -EFAULT;
802 803
803 return 0; 804 return 0;
804err: 805err: