Commit 77a8710b authored by Al Viro's avatar Al Viro

parisc: turn csum_partial_copy_from_user() into csum_and_copy_from_user()

Already has the right semantics.  Incidentally. failing copy_from_user()
zeroes the tail of destination - no need to repeat that manually
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 808b49da
...@@ -26,11 +26,12 @@ extern __wsum csum_partial(const void *, int, __wsum); ...@@ -26,11 +26,12 @@ extern __wsum csum_partial(const void *, int, __wsum);
*/ */
extern __wsum csum_partial_copy_nocheck(const void *, void *, int, __wsum); extern __wsum csum_partial_copy_nocheck(const void *, void *, int, __wsum);
#define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
/* /*
* this is a new version of the above that records errors it finds in *errp, * this is a new version of the above that records errors it finds in *errp,
* but continues and zeros the rest of the buffer. * but continues and zeros the rest of the buffer.
*/ */
extern __wsum csum_partial_copy_from_user(const void __user *src, extern __wsum csum_and_copy_from_user(const void __user *src,
void *dst, int len, __wsum sum, int *errp); void *dst, int len, __wsum sum, int *errp);
/* /*
......
...@@ -128,18 +128,12 @@ EXPORT_SYMBOL(csum_partial_copy_nocheck); ...@@ -128,18 +128,12 @@ EXPORT_SYMBOL(csum_partial_copy_nocheck);
* Copy from userspace and compute checksum. If we catch an exception * Copy from userspace and compute checksum. If we catch an exception
* then zero the rest of the buffer. * then zero the rest of the buffer.
*/ */
__wsum csum_partial_copy_from_user(const void __user *src, __wsum csum_and_copy_from_user(const void __user *src,
void *dst, int len, void *dst, int len,
__wsum sum, int *err_ptr) __wsum sum, int *err_ptr)
{ {
int missing; if (copy_from_user(dst, src, len))
missing = copy_from_user(dst, src, len);
if (missing) {
memset(dst + len - missing, 0, missing);
*err_ptr = -EFAULT; *err_ptr = -EFAULT;
}
return csum_partial(dst, len, sum); return csum_partial(dst, len, sum);
} }
EXPORT_SYMBOL(csum_partial_copy_from_user); EXPORT_SYMBOL(csum_and_copy_from_user);
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