From: Nicolas Pitre Date: Sun, 24 Jul 2016 15:30:23 +0000 (-0400) Subject: binfmt_flat: use clear_user() rather than memset() to clear .bss X-Git-Tag: v4.14-rc1~2718^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=467aa1465a7b9f0bd1a23c83bff8c38e3c3e660e;p=platform%2Fkernel%2Flinux-rpi.git binfmt_flat: use clear_user() rather than memset() to clear .bss This is needed on systems with a MMU. Signed-off-by: Nicolas Pitre Reviewed-by: Greg Ungerer Signed-off-by: Greg Ungerer --- diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c index 8e812d7..eb747a26 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: