MIPS: asm: checksum: Add MIPS specific csum_and_copy_from_user function
authorLeonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Tue, 17 Dec 2013 09:30:13 +0000 (09:30 +0000)
committerRalf Baechle <ralf@linux-mips.org>
Wed, 26 Mar 2014 22:09:17 +0000 (23:09 +0100)
A MIPS specific csum_and_copy_from_user function is necessary because
the generic one from include/net/checksum.h will not work for EVA.
This is because the generic one will link to symbols from lib/checksum.c
which are not EVA aware.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
arch/mips/include/asm/checksum.h

index f5602c6957c76f537630a0ce3d0d4142309a0a1d..3418c51e11512ed2a3957448fbb68d83ebac1858 100644 (file)
@@ -54,6 +54,20 @@ __wsum csum_partial_copy_from_user(const void __user *src, void *dst, int len,
                                                     len, sum, err_ptr);
 }
 
+#define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
+static inline
+__wsum csum_and_copy_from_user(const void __user *src, void *dst,
+                              int len, __wsum sum, int *err_ptr)
+{
+       if (access_ok(VERIFY_READ, src, len))
+               return csum_partial_copy_from_user(src, dst, len, sum,
+                                                  err_ptr);
+       if (len)
+               *err_ptr = -EFAULT;
+
+       return sum;
+}
+
 /*
  * Copy and checksum to user
  */