Skip to content

Commit 7fe8970

Browse files
author
Al Viro
committed
sh32: convert to csum_and_copy_from_user()
Signed-off-by: Al Viro <[email protected]>
1 parent 8084c99 commit 7fe8970

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

arch/sh/include/asm/checksum_32.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,17 @@ __wsum csum_partial_copy_nocheck(const void *src, void *dst,
4848
return csum_partial_copy_generic(src, dst, len, sum, NULL, NULL);
4949
}
5050

51+
#define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
5152
static inline
52-
__wsum csum_partial_copy_from_user(const void __user *src, void *dst,
53+
__wsum csum_and_copy_from_user(const void __user *src, void *dst,
5354
int len, __wsum sum, int *err_ptr)
5455
{
55-
return csum_partial_copy_generic((__force const void *)src, dst,
56+
if (access_ok(src, len))
57+
return csum_partial_copy_generic((__force const void *)src, dst,
5658
len, sum, err_ptr, NULL);
59+
if (len)
60+
*err_ptr = -EFAULT;
61+
return sum;
5762
}
5863

5964
/*

0 commit comments

Comments
 (0)