Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

Al Viro 1d60be3c b7121395

+9 -26
+2 -5
arch/arm/include/asm/checksum.h
··· 38 38 csum_partial_copy_nocheck(const void *src, void *dst, int len); 39 39 40 40 __wsum 41 - csum_partial_copy_from_user(const void __user *src, void *dst, int len, __wsum sum, int *err_ptr); 41 + csum_partial_copy_from_user(const void __user *src, void *dst, int len); 42 42 43 43 #define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER 44 44 #define _HAVE_ARCH_CSUM_AND_COPY 45 45 static inline 46 46 __wsum csum_and_copy_from_user(const void __user *src, void *dst, int len) 47 47 { 48 - int err = 0; 49 - 50 48 if (!access_ok(src, len)) 51 49 return 0; 52 50 53 - sum = csum_partial_copy_from_user(src, dst, len, ~0U, &err); 54 - return err ? 0 : sum; 51 + return csum_partial_copy_from_user(src, dst, len); 55 52 } 56 53 57 54 /*
-1
arch/arm/lib/csumpartialcopy.S
··· 16 16 17 17 .macro save_regs 18 18 stmfd sp!, {r1, r4 - r8, lr} 19 - mov r3, #0 20 19 .endm 21 20 22 21 .macro load_regs
+1
arch/arm/lib/csumpartialcopygeneric.S
··· 86 86 87 87 FN_ENTRY 88 88 save_regs 89 + mov sum, #-1 89 90 90 91 cmp len, #8 @ Ensure that we have at least 91 92 blo .Lless8 @ 8 bytes to copy.
+6 -20
arch/arm/lib/csumpartialcopyuser.S
··· 62 62 63 63 /* 64 64 * unsigned int 65 - * csum_partial_copy_from_user(const char *src, char *dst, int len, int sum, int *err_ptr) 66 - * r0 = src, r1 = dst, r2 = len, r3 = sum, [sp] = *err_ptr 67 - * Returns : r0 = checksum, [[sp, #0], #0] = 0 or -EFAULT 65 + * csum_partial_copy_from_user(const char *src, char *dst, int len) 66 + * r0 = src, r1 = dst, r2 = len 67 + * Returns : r0 = checksum or 0 68 68 */ 69 69 70 70 #define FN_ENTRY ENTRY(csum_partial_copy_from_user) ··· 73 73 #include "csumpartialcopygeneric.S" 74 74 75 75 /* 76 - * FIXME: minor buglet here 77 - * We don't return the checksum for the data present in the buffer. To do 78 - * so properly, we would have to add in whatever registers were loaded before 79 - * the fault, which, with the current asm above is not predictable. 76 + * We report fault by returning 0 csum - impossible in normal case, since 77 + * we start with 0xffffffff for initial sum. 80 78 */ 81 79 .pushsection .text.fixup,"ax" 82 80 .align 4 83 - 9001: mov r4, #-EFAULT 84 - #ifdef CONFIG_CPU_SW_DOMAIN_PAN 85 - ldr r5, [sp, #9*4] @ *err_ptr 86 - #else 87 - ldr r5, [sp, #8*4] @ *err_ptr 88 - #endif 89 - str r4, [r5] 90 - ldmia sp, {r1, r2} @ retrieve dst, len 91 - add r2, r2, r1 92 - mov r0, #0 @ zero the buffer 93 - 9002: teq r2, r1 94 - strbne r0, [r1], #1 95 - bne 9002b 81 + 9001: mov r0, #0 96 82 load_regs 97 83 .popsection