Commit bfdaf029 authored by Al Viro's avatar Al Viro

ia64: turn csum_partial_copy_from_user() into csum_and_copy_from_user()

Just use copy_from_user() there, rather than relying upon the wrapper
to have done access_ok()
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent cc03f19c
...@@ -37,13 +37,14 @@ extern __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, ...@@ -37,13 +37,14 @@ extern __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
*/ */
extern __wsum csum_partial(const void *buff, int len, __wsum sum); extern __wsum csum_partial(const void *buff, int len, __wsum sum);
#define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
/* /*
* Same as csum_partial, but copies from src while it checksums. * Same as csum_partial, but copies from src while it checksums.
* *
* Here it is even more important to align src and dst on a 32-bit (or * Here it is even more important to align src and dst on a 32-bit (or
* even better 64-bit) boundary. * even better 64-bit) boundary.
*/ */
extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst, extern __wsum csum_and_copy_from_user(const void __user *src, void *dst,
int len, __wsum sum, int len, __wsum sum,
int *errp); int *errp);
......
...@@ -103,33 +103,23 @@ unsigned long do_csum_c(const unsigned char * buff, int len, unsigned int psum) ...@@ -103,33 +103,23 @@ unsigned long do_csum_c(const unsigned char * buff, int len, unsigned int psum)
* This is very ugly but temporary. THIS NEEDS SERIOUS ENHANCEMENTS. * This is very ugly but temporary. THIS NEEDS SERIOUS ENHANCEMENTS.
* But it's very tricky to get right even in C. * But it's very tricky to get right even in C.
*/ */
extern unsigned long do_csum(const unsigned char *, long);
__wsum __wsum
csum_partial_copy_from_user(const void __user *src, void *dst, csum_and_copy_from_user(const void __user *src, void *dst,
int len, __wsum psum, int *errp) int len, __wsum psum, int *errp)
{ {
unsigned long result;
/* XXX Fixme /* XXX Fixme
* for now we separate the copy from checksum for obvious * for now we separate the copy from checksum for obvious
* alignment difficulties. Look at the Alpha code and you'll be * alignment difficulties. Look at the Alpha code and you'll be
* scared. * scared.
*/ */
if (__copy_from_user(dst, src, len) != 0 && errp) if (copy_from_user(dst, src, len))
*errp = -EFAULT; *errp = -EFAULT;
result = do_csum(dst, len); return csum_partial(dst, len, psum);
/* add in old sum, and carry.. */
result += (__force u32)psum;
/* 32+c bits -> 32 bits */
result = (result & 0xffffffff) + (result >> 32);
return (__force __wsum)result;
} }
EXPORT_SYMBOL(csum_partial_copy_from_user); EXPORT_SYMBOL(csum_and_copy_from_user);
__wsum __wsum
csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum) csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment