Commit 5904122c authored by Al Viro's avatar Al Viro
Browse files

take the dummy csum_and_copy_from_user() into net/checksum.h



now that can be done conveniently - all non-trivial cases have
_HAVE_ARCH_COPY_AND_CSUM_FROM_USER defined, so the fallback in
net/checksum.h is used only for dummy (copy_from_user, then
csum_partial) implementation.  Allowing us to get rid of all
dummy instances, both of csum_and_copy_from_user() and
csum_partial_copy_from_user().

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 24f9aa92
Loading
Loading
Loading
Loading
+0 −22
Original line number Diff line number Diff line
@@ -4,28 +4,6 @@
#include <linux/module.h>
#include <net/checksum.h>

#include <asm/byteorder.h>

/*
 * copy from fs while checksumming, otherwise like csum_partial
 */
__wsum
csum_partial_copy_from_user(const void __user *src, void *dst, int len,
			    __wsum sum, int *csum_err)
{
	int missing;

	missing = __copy_from_user(dst, src, len);
	if (missing) {
		memset(dst + len - missing, 0, missing);
		*csum_err = -EFAULT;
	} else
		*csum_err = 0;

	return csum_partial(dst, len, sum);
}
EXPORT_SYMBOL(csum_partial_copy_from_user);

/* These are from csum_64plus.S */
EXPORT_SYMBOL(csum_partial);
EXPORT_SYMBOL(csum_partial_copy);
+0 −11
Original line number Diff line number Diff line
@@ -37,17 +37,6 @@ extern __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
 */
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.
 *
 * Here it is even more important to align src and dst on a 32-bit (or
 * even better 64-bit) boundary.
 */
extern __wsum csum_and_copy_from_user(const void __user *src, void *dst,
						 int len, __wsum sum,
						 int *errp);

extern __wsum csum_partial_copy_nocheck(const void *src, void *dst,
					       int len, __wsum sum);

+0 −18
Original line number Diff line number Diff line
@@ -103,24 +103,6 @@ out:
 * This is very ugly but temporary. THIS NEEDS SERIOUS ENHANCEMENTS.
 * But it's very tricky to get right even in C.
 */
__wsum
csum_and_copy_from_user(const void __user *src, void *dst,
				int len, __wsum psum, int *errp)
{
	/* XXX Fixme
	 * for now we separate the copy from checksum for obvious
	 * alignment difficulties. Look at the Alpha code and you'll be
	 * scared.
	 */

	if (copy_from_user(dst, src, len))
		*errp = -EFAULT;

	return csum_partial(dst, len, psum);
}

EXPORT_SYMBOL(csum_and_copy_from_user);

__wsum
csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
{
+0 −2
Original line number Diff line number Diff line
@@ -14,8 +14,6 @@
extern __wsum csum_partial(const void *buff, int len, __wsum sum);
extern __wsum csum_partial_copy(const void *src, void *dst, int len,
				__wsum sum);
extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
					int len, __wsum sum, int *csum_err);
#define csum_partial_copy_nocheck(src, dst, len, sum)	\
	csum_partial_copy((src), (dst), (len), (sum))

+0 −8
Original line number Diff line number Diff line
@@ -26,14 +26,6 @@ extern __wsum csum_partial(const 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,
 * but continues and zeros the rest of the buffer.
 */
extern __wsum csum_and_copy_from_user(const void __user *src,
		void *dst, int len, __wsum sum, int *errp);

/*
 *	Optimized for IP headers, which always checksum on 4 octet boundaries.
 *
Loading