aboutsummaryrefslogtreecommitdiff
path: root/arch/um/include
diff options
context:
space:
mode:
authorBodo Stroesser <bstroesser@fujitsu-siemens.com>2005-05-05 16:15:36 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-05 16:36:38 -0700
commit7d37c6d52fce13008f20344790a81a6a5a0003b3 (patch)
treeebf98bc32d8c0e29627f7be8a4dd349a32efff1d /arch/um/include
parentc52ac046757deebc514483e407dca39a9c774aa3 (diff)
[PATCH] uml: s390 preparation, checksumming done in arch code
Checksum handling largely depends on the subarch. Thus, I renamed i386 arch_csum_partial in arch/um/sys-i386/checksum.S back to csum_partial, removed csum_partial from arch/um/kernel/checksum.c and shifted EXPORT_SYMBOL(csum_partial) to arch/um/sys-i386/ksyms.c. Then, csum_partial_copy_to and csum_partial_copy_from were shifted from arch/um/kernel/checksum.c to arch/um/include/sysdep-i386/checksum.h and inserted in the calling functions csum_partial_copy_from_user() and csum_and_copy_to_user(). Now, arch/um/kernel/checksum.c is empty and removed. Signed-off-by: Bodo Stroesser <bstroesser@fujitsu-siemens.com> Signed-off-by: Jeff Dike <jdike@addtoit.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/include')
-rw-r--r--arch/um/include/sysdep-i386/checksum.h39
1 files changed, 22 insertions, 17 deletions
diff --git a/arch/um/include/sysdep-i386/checksum.h b/arch/um/include/sysdep-i386/checksum.h
index 3a2a45811aa..764ba4db478 100644
--- a/arch/um/include/sysdep-i386/checksum.h
+++ b/arch/um/include/sysdep-i386/checksum.h
@@ -24,19 +24,6 @@ unsigned int csum_partial(const unsigned char * buff, int len,
unsigned int sum);
/*
- * the same as csum_partial, but copies from src while it
- * checksums, and handles user-space pointer exceptions correctly, when needed.
- *
- * here even more important to align src and dst on a 32-bit (or even
- * better 64-bit) boundary
- */
-
-unsigned int csum_partial_copy_to(const unsigned char *src, unsigned char *dst,
- int len, int sum, int *err_ptr);
-unsigned int csum_partial_copy_from(const unsigned char *src, unsigned char *dst,
- int len, int sum, int *err_ptr);
-
-/*
* Note: when you get a NULL pointer exception here this means someone
* passed in an incorrect kernel address to one of these functions.
*
@@ -52,11 +39,24 @@ unsigned int csum_partial_copy_nocheck(const unsigned char *src, unsigned char *
return(csum_partial(dst, len, sum));
}
+/*
+ * the same as csum_partial, but copies from src while it
+ * checksums, and handles user-space pointer exceptions correctly, when needed.
+ *
+ * here even more important to align src and dst on a 32-bit (or even
+ * better 64-bit) boundary
+ */
+
static __inline__
unsigned int csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst,
int len, int sum, int *err_ptr)
{
- return csum_partial_copy_from(src, dst, len, sum, err_ptr);
+ if(copy_from_user(dst, src, len)){
+ *err_ptr = -EFAULT;
+ return(-1);
+ }
+
+ return csum_partial(dst, len, sum);
}
/*
@@ -67,7 +67,6 @@ unsigned int csum_partial_copy_from_user(const unsigned char *src, unsigned char
*/
#define csum_partial_copy_fromuser csum_partial_copy_from_user
-unsigned int csum_partial_copy(const unsigned char *src, unsigned char *dst, int len, int sum);
/*
* This is a version of ip_compute_csum() optimized for IP headers,
@@ -196,8 +195,14 @@ static __inline__ unsigned int csum_and_copy_to_user(const unsigned char *src,
unsigned char *dst,
int len, int sum, int *err_ptr)
{
- if (access_ok(VERIFY_WRITE, dst, len))
- return(csum_partial_copy_to(src, dst, len, sum, err_ptr));
+ if (access_ok(VERIFY_WRITE, dst, len)){
+ if(copy_to_user(dst, src, len)){
+ *err_ptr = -EFAULT;
+ return(-1);
+ }
+
+ return csum_partial(src, len, sum);
+ }
if (len)
*err_ptr = -EFAULT;