Skip to content

Commit 24f9aa9

Browse files
author
Al Viro
committed
arm: switch to csum_and_copy_from_user()
Note that csum_partial_copy_from_user() is in assembler here, so I'm leaving it alone and just providing the wrapper for it. When/if we go for switching arm to user_access_{begin,end}() (doing domain switches in those), somebody well need to look into that one. Signed-off-by: Al Viro <[email protected]>
1 parent 7fe8970 commit 24f9aa9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

arch/arm/include/asm/checksum.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,20 @@ csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum);
4040
__wsum
4141
csum_partial_copy_from_user(const void __user *src, void *dst, int len, __wsum sum, int *err_ptr);
4242

43+
#define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
44+
static inline
45+
__wsum csum_and_copy_from_user (const void __user *src, void *dst,
46+
int len, __wsum sum, int *err_ptr)
47+
{
48+
if (access_ok(src, len))
49+
return csum_partial_copy_from_user(src, dst, len, sum, err_ptr);
50+
51+
if (len)
52+
*err_ptr = -EFAULT;
53+
54+
return sum;
55+
}
56+
4357
/*
4458
* Fold a partial checksum without adding pseudo headers
4559
*/

0 commit comments

Comments
 (0)