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-28 13:29:11 +1000
commit467aa1465a7b9f0bd1a23c83bff8c38e3c3e660e (patch)
treee5e478b273192a601f81bee6a8d3f78116cdffb9 /fs/binfmt_flat.c
parent1b2ce442ea96b1e76300553963154d68cc5b4ad0 (diff)
downloadlinux-467aa1465a7b9f0bd1a23c83bff8c38e3c3e660e.tar.bz2
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,
flush_icache_range(start_code, end_code);
/* zero the BSS, BRK and stack areas */
- memset((void *)(datapos + data_len), 0, bss_len +
- (memp + memp_size - stack_len - /* end brk */
- libinfo->lib_list[id].start_brk) + /* start brk */
- stack_len);
+ if (clear_user((void __user *)(datapos + data_len), bss_len +
+ (memp + memp_size - stack_len - /* end brk */
+ libinfo->lib_list[id].start_brk) + /* start brk */
+ stack_len))
+ return -EFAULT;
return 0;
err: