| .. | .. |
|---|
| 20 | 20 | */ |
|---|
| 21 | 21 | extern __wsum csum_partial(const void *buff, int len, __wsum sum); |
|---|
| 22 | 22 | |
|---|
| 23 | | -/* |
|---|
| 24 | | - * Note: when you get a NULL pointer exception here this means someone |
|---|
| 25 | | - * passed in an incorrect kernel address to one of these functions. |
|---|
| 26 | | - * |
|---|
| 27 | | - * If you use these functions directly please don't forget the |
|---|
| 28 | | - * access_ok(). |
|---|
| 29 | | - */ |
|---|
| 30 | | - |
|---|
| 31 | | -static __inline__ |
|---|
| 32 | | -__wsum csum_partial_copy_nocheck(const void *src, void *dst, |
|---|
| 33 | | - int len, __wsum sum) |
|---|
| 34 | | -{ |
|---|
| 35 | | - memcpy(dst, src, len); |
|---|
| 36 | | - return csum_partial(dst, len, sum); |
|---|
| 37 | | -} |
|---|
| 38 | | - |
|---|
| 39 | | -/* |
|---|
| 40 | | - * the same as csum_partial, but copies from src while it |
|---|
| 41 | | - * checksums, and handles user-space pointer exceptions correctly, when needed. |
|---|
| 42 | | - * |
|---|
| 43 | | - * here even more important to align src and dst on a 32-bit (or even |
|---|
| 44 | | - * better 64-bit) boundary |
|---|
| 45 | | - */ |
|---|
| 46 | | - |
|---|
| 47 | | -static __inline__ |
|---|
| 48 | | -__wsum csum_partial_copy_from_user(const void __user *src, void *dst, |
|---|
| 49 | | - int len, __wsum sum, int *err_ptr) |
|---|
| 50 | | -{ |
|---|
| 51 | | - if (copy_from_user(dst, src, len)) { |
|---|
| 52 | | - *err_ptr = -EFAULT; |
|---|
| 53 | | - return (__force __wsum)-1; |
|---|
| 54 | | - } |
|---|
| 55 | | - |
|---|
| 56 | | - return csum_partial(dst, len, sum); |
|---|
| 57 | | -} |
|---|
| 58 | | - |
|---|
| 59 | 23 | /** |
|---|
| 60 | 24 | * csum_fold - Fold and invert a 32bit checksum. |
|---|
| 61 | 25 | * sum: 32bit unfolded sum |
|---|