arm: don't zero in __copy_from_user_inatomic()/__copy_from_user()
adjust copy_from_user(), obviously Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
7798bf2140
commit
91344493b7
|
@ -533,11 +533,12 @@ __clear_user(void __user *addr, unsigned long n)
|
||||||
|
|
||||||
static inline unsigned long __must_check copy_from_user(void *to, const void __user *from, unsigned long n)
|
static inline unsigned long __must_check copy_from_user(void *to, const void __user *from, unsigned long n)
|
||||||
{
|
{
|
||||||
if (access_ok(VERIFY_READ, from, n))
|
unsigned long res = n;
|
||||||
n = __copy_from_user(to, from, n);
|
if (likely(access_ok(VERIFY_READ, from, n)))
|
||||||
else /* security hole - plug it */
|
res = __copy_from_user(to, from, n);
|
||||||
memset(to, 0, n);
|
if (unlikely(res))
|
||||||
return n;
|
memset(to + (n - res), 0, res);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned long __must_check copy_to_user(void __user *to, const void *from, unsigned long n)
|
static inline unsigned long __must_check copy_to_user(void __user *to, const void *from, unsigned long n)
|
||||||
|
|
|
@ -98,12 +98,9 @@ ENDPROC(arm_copy_from_user)
|
||||||
.pushsection .fixup,"ax"
|
.pushsection .fixup,"ax"
|
||||||
.align 0
|
.align 0
|
||||||
copy_abort_preamble
|
copy_abort_preamble
|
||||||
ldmfd sp!, {r1, r2}
|
ldmfd sp!, {r1, r2, r3}
|
||||||
sub r3, r0, r1
|
sub r0, r0, r1
|
||||||
rsb r1, r3, r2
|
rsb r0, r0, r2
|
||||||
str r1, [sp]
|
|
||||||
bl __memzero
|
|
||||||
ldr r0, [sp], #4
|
|
||||||
copy_abort_end
|
copy_abort_end
|
||||||
.popsection
|
.popsection
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue