Skip to content

Commit 1d60be3

Browse files
author
Al Viro
committed
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>
1 parent b712139 commit 1d60be3

4 files changed

Lines changed: 9 additions & 26 deletions

File tree

‎arch/arm/include/asm/checksum.h‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,17 @@ __wsum
3838
csum_partial_copy_nocheck(const void *src, void *dst, int len);
3939

4040
__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);
4242

4343
#define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
4444
#define _HAVE_ARCH_CSUM_AND_COPY
4545
static inline
4646
__wsum csum_and_copy_from_user(const void __user *src, void *dst, int len)
4747
{
48-
int err = 0;
49-
5048
if (!access_ok(src, len))
5149
return 0;
5250

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);
5552
}
5653

5754
/*

‎arch/arm/lib/csumpartialcopy.S‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
.macro save_regs
1818
stmfd sp!, {r1, r4 - r8, lr}
19-
mov r3, #0
2019
.endm
2120

2221
.macro load_regs

‎arch/arm/lib/csumpartialcopygeneric.S‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ sum .req r3
8686

8787
FN_ENTRY
8888
save_regs
89+
mov sum, #-1
8990

9091
cmp len, #8 @ Ensure that we have at least
9192
blo .Lless8 @ 8 bytes to copy.

‎arch/arm/lib/csumpartialcopyuser.S‎

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@
6262

6363
/*
6464
* 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
6868
*/
6969

7070
#define FN_ENTRY ENTRY(csum_partial_copy_from_user)
@@ -73,25 +73,11 @@
7373
#include "csumpartialcopygeneric.S"
7474

7575
/*
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.
8078
*/
8179
.pushsection .text.fixup,"ax"
8280
.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
9682
load_regs
9783
.popsection

0 commit comments

Comments
 (0)