git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge to kernel-2.6.20-1.2949.fc6.vs2.2.0.1
[linux-2.6.git]
/
arch
/
frv
/
lib
/
checksum.c
diff --git
a/arch/frv/lib/checksum.c
b/arch/frv/lib/checksum.c
index
7bf5bd6
..
44e16d5
100644
(file)
--- a/
arch/frv/lib/checksum.c
+++ b/
arch/frv/lib/checksum.c
@@
-32,7
+32,7
@@
of the assembly has to go. */
#include <net/checksum.h>
of the assembly has to go. */
#include <net/checksum.h>
-#include <
asm/checksum
.h>
+#include <
linux/module
.h>
static inline unsigned short from32to16(unsigned long x)
{
static inline unsigned short from32to16(unsigned long x)
{
@@
-104,45
+104,63
@@
out:
*
* it's best to have buff aligned on a 32-bit boundary
*/
*
* it's best to have buff aligned on a 32-bit boundary
*/
-
unsigned int csum_partial(const unsigned char * buff, int len, unsigned int
sum)
+
__wsum csum_partial(const void *buff, int len, __wsum
sum)
{
unsigned int result = do_csum(buff, len);
/* add in old sum, and carry.. */
{
unsigned int result = do_csum(buff, len);
/* add in old sum, and carry.. */
- result += sum;
- if (sum > result)
+ result +=
(__force u32)
sum;
+ if (
(__force u32)
sum > result)
result += 1;
result += 1;
- return result;
+ return
(__force __wsum)
result;
}
}
+EXPORT_SYMBOL(csum_partial);
+
/*
* this routine is used for miscellaneous IP-like checksums, mainly
* in icmp.c
*/
/*
* this routine is used for miscellaneous IP-like checksums, mainly
* in icmp.c
*/
-
unsigned short ip_compute_csum(const unsigned char *
buff, int len)
+
__sum16 ip_compute_csum(const void *
buff, int len)
{
{
- return
~do_csum(buff,
len);
+ return
(__force __sum16)~do_csum(buff,
len);
}
}
+EXPORT_SYMBOL(ip_compute_csum);
+
/*
* copy from fs while checksumming, otherwise like csum_partial
*/
/*
* copy from fs while checksumming, otherwise like csum_partial
*/
-
-unsigned int
-
csum_partial_copy_from_user(const char *src, char *dst, int len, int
sum, int *csum_err)
+__wsum
+csum_partial_copy_from_user(const void __user *src, void *dst,
+
int len, __wsum
sum, int *csum_err)
{
{
- if (csum_err) *csum_err = 0;
- memcpy(dst, src, len);
+ int rem;
+
+ if (csum_err)
+ *csum_err = 0;
+
+ rem = copy_from_user(dst, src, len);
+ if (rem != 0) {
+ if (csum_err)
+ *csum_err = -EFAULT;
+ memset(dst + len - rem, 0, rem);
+ len = rem;
+ }
+
return csum_partial(dst, len, sum);
}
return csum_partial(dst, len, sum);
}
+EXPORT_SYMBOL(csum_partial_copy_from_user);
+
/*
* copy from ds while checksumming, otherwise like csum_partial
*/
/*
* copy from ds while checksumming, otherwise like csum_partial
*/
-
-unsigned int
-csum_partial_copy(const char *src, char *dst, int len, int sum)
+__wsum
+csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
{
memcpy(dst, src, len);
return csum_partial(dst, len, sum);
}
{
memcpy(dst, src, len);
return csum_partial(dst, len, sum);
}
+
+EXPORT_SYMBOL(csum_partial_copy_nocheck);