forked from luck/tmp_suning_uos_patched
arm: propagate the calling convention changes down to csum_partial_copy_from_user()
... and get rid of the "clean the destination on error" crap. Simplifies the fault handlers and the function itself... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
b712139543
commit
1d60be3c25
|
@ -38,20 +38,17 @@ __wsum
|
||||||
csum_partial_copy_nocheck(const void *src, void *dst, int len);
|
csum_partial_copy_nocheck(const void *src, void *dst, int len);
|
||||||
|
|
||||||
__wsum
|
__wsum
|
||||||
csum_partial_copy_from_user(const void __user *src, void *dst, int len, __wsum sum, int *err_ptr);
|
csum_partial_copy_from_user(const void __user *src, void *dst, int len);
|
||||||
|
|
||||||
#define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
|
#define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
|
||||||
#define _HAVE_ARCH_CSUM_AND_COPY
|
#define _HAVE_ARCH_CSUM_AND_COPY
|
||||||
static inline
|
static inline
|
||||||
__wsum csum_and_copy_from_user(const void __user *src, void *dst, int len)
|
__wsum csum_and_copy_from_user(const void __user *src, void *dst, int len)
|
||||||
{
|
{
|
||||||
int err = 0;
|
|
||||||
|
|
||||||
if (!access_ok(src, len))
|
if (!access_ok(src, len))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
sum = csum_partial_copy_from_user(src, dst, len, ~0U, &err);
|
return csum_partial_copy_from_user(src, dst, len);
|
||||||
return err ? 0 : sum;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
.macro save_regs
|
.macro save_regs
|
||||||
stmfd sp!, {r1, r4 - r8, lr}
|
stmfd sp!, {r1, r4 - r8, lr}
|
||||||
mov r3, #0
|
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
.macro load_regs
|
.macro load_regs
|
||||||
|
|
|
@ -86,6 +86,7 @@ sum .req r3
|
||||||
|
|
||||||
FN_ENTRY
|
FN_ENTRY
|
||||||
save_regs
|
save_regs
|
||||||
|
mov sum, #-1
|
||||||
|
|
||||||
cmp len, #8 @ Ensure that we have at least
|
cmp len, #8 @ Ensure that we have at least
|
||||||
blo .Lless8 @ 8 bytes to copy.
|
blo .Lless8 @ 8 bytes to copy.
|
||||||
|
|
|
@ -62,9 +62,9 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* unsigned int
|
* unsigned int
|
||||||
* csum_partial_copy_from_user(const char *src, char *dst, int len, int sum, int *err_ptr)
|
* csum_partial_copy_from_user(const char *src, char *dst, int len)
|
||||||
* r0 = src, r1 = dst, r2 = len, r3 = sum, [sp] = *err_ptr
|
* r0 = src, r1 = dst, r2 = len
|
||||||
* Returns : r0 = checksum, [[sp, #0], #0] = 0 or -EFAULT
|
* Returns : r0 = checksum or 0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define FN_ENTRY ENTRY(csum_partial_copy_from_user)
|
#define FN_ENTRY ENTRY(csum_partial_copy_from_user)
|
||||||
|
@ -73,25 +73,11 @@
|
||||||
#include "csumpartialcopygeneric.S"
|
#include "csumpartialcopygeneric.S"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FIXME: minor buglet here
|
* We report fault by returning 0 csum - impossible in normal case, since
|
||||||
* We don't return the checksum for the data present in the buffer. To do
|
* we start with 0xffffffff for initial sum.
|
||||||
* so properly, we would have to add in whatever registers were loaded before
|
|
||||||
* the fault, which, with the current asm above is not predictable.
|
|
||||||
*/
|
*/
|
||||||
.pushsection .text.fixup,"ax"
|
.pushsection .text.fixup,"ax"
|
||||||
.align 4
|
.align 4
|
||||||
9001: mov r4, #-EFAULT
|
9001: mov r0, #0
|
||||||
#ifdef CONFIG_CPU_SW_DOMAIN_PAN
|
|
||||||
ldr r5, [sp, #9*4] @ *err_ptr
|
|
||||||
#else
|
|
||||||
ldr r5, [sp, #8*4] @ *err_ptr
|
|
||||||
#endif
|
|
||||||
str r4, [r5]
|
|
||||||
ldmia sp, {r1, r2} @ retrieve dst, len
|
|
||||||
add r2, r2, r1
|
|
||||||
mov r0, #0 @ zero the buffer
|
|
||||||
9002: teq r2, r1
|
|
||||||
strbne r0, [r1], #1
|
|
||||||
bne 9002b
|
|
||||||
load_regs
|
load_regs
|
||||||
.popsection
|
.popsection
|
||||||
|
|
Loading…
Reference in New Issue
Block a user