| .. | .. |
|---|
| 13 | 13 | |
|---|
| 14 | 14 | #include <linux/in6.h> |
|---|
| 15 | 15 | #include <linux/uaccess.h> |
|---|
| 16 | | -#include <variant/core.h> |
|---|
| 16 | +#include <asm/core.h> |
|---|
| 17 | 17 | |
|---|
| 18 | 18 | /* |
|---|
| 19 | 19 | * computes the checksum of a memory block at buff, length len, |
|---|
| .. | .. |
|---|
| 37 | 37 | * better 64-bit) boundary |
|---|
| 38 | 38 | */ |
|---|
| 39 | 39 | |
|---|
| 40 | | -asmlinkage __wsum csum_partial_copy_generic(const void *src, void *dst, |
|---|
| 41 | | - int len, __wsum sum, |
|---|
| 42 | | - int *src_err_ptr, int *dst_err_ptr); |
|---|
| 40 | +asmlinkage __wsum csum_partial_copy_generic(const void *src, void *dst, int len); |
|---|
| 43 | 41 | |
|---|
| 42 | +#define _HAVE_ARCH_CSUM_AND_COPY |
|---|
| 44 | 43 | /* |
|---|
| 45 | 44 | * Note: when you get a NULL pointer exception here this means someone |
|---|
| 46 | 45 | * passed in an incorrect kernel address to one of these functions. |
|---|
| 47 | | - * |
|---|
| 48 | | - * If you use these functions directly please don't forget the access_ok(). |
|---|
| 49 | 46 | */ |
|---|
| 50 | 47 | static inline |
|---|
| 51 | | -__wsum csum_partial_copy_nocheck(const void *src, void *dst, |
|---|
| 52 | | - int len, __wsum sum) |
|---|
| 48 | +__wsum csum_partial_copy_nocheck(const void *src, void *dst, int len) |
|---|
| 53 | 49 | { |
|---|
| 54 | | - return csum_partial_copy_generic(src, dst, len, sum, NULL, NULL); |
|---|
| 50 | + return csum_partial_copy_generic(src, dst, len); |
|---|
| 55 | 51 | } |
|---|
| 56 | 52 | |
|---|
| 53 | +#define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER |
|---|
| 57 | 54 | static inline |
|---|
| 58 | | -__wsum csum_partial_copy_from_user(const void __user *src, void *dst, |
|---|
| 59 | | - int len, __wsum sum, int *err_ptr) |
|---|
| 55 | +__wsum csum_and_copy_from_user(const void __user *src, void *dst, |
|---|
| 56 | + int len) |
|---|
| 60 | 57 | { |
|---|
| 61 | | - return csum_partial_copy_generic((__force const void *)src, dst, |
|---|
| 62 | | - len, sum, err_ptr, NULL); |
|---|
| 58 | + if (!access_ok(src, len)) |
|---|
| 59 | + return 0; |
|---|
| 60 | + return csum_partial_copy_generic((__force const void *)src, dst, len); |
|---|
| 63 | 61 | } |
|---|
| 64 | 62 | |
|---|
| 65 | 63 | /* |
|---|
| .. | .. |
|---|
| 240 | 238 | */ |
|---|
| 241 | 239 | #define HAVE_CSUM_COPY_USER |
|---|
| 242 | 240 | static __inline__ __wsum csum_and_copy_to_user(const void *src, |
|---|
| 243 | | - void __user *dst, int len, |
|---|
| 244 | | - __wsum sum, int *err_ptr) |
|---|
| 241 | + void __user *dst, int len) |
|---|
| 245 | 242 | { |
|---|
| 246 | | - if (access_ok(VERIFY_WRITE, dst, len)) |
|---|
| 247 | | - return csum_partial_copy_generic(src,dst,len,sum,NULL,err_ptr); |
|---|
| 248 | | - |
|---|
| 249 | | - if (len) |
|---|
| 250 | | - *err_ptr = -EFAULT; |
|---|
| 251 | | - |
|---|
| 252 | | - return (__force __wsum)-1; /* invalid checksum */ |
|---|
| 243 | + if (!access_ok(dst, len)) |
|---|
| 244 | + return 0; |
|---|
| 245 | + return csum_partial_copy_generic(src, (__force void *)dst, len); |
|---|
| 253 | 246 | } |
|---|
| 254 | 247 | #endif |
|---|