diff options
Diffstat (limited to 'arch/h8300')
-rw-r--r-- | arch/h8300/kernel/h8300_ksyms.c | 2 | ||||
-rw-r--r-- | arch/h8300/lib/checksum.c | 29 |
2 files changed, 18 insertions, 13 deletions
diff --git a/arch/h8300/kernel/h8300_ksyms.c b/arch/h8300/kernel/h8300_ksyms.c index 9b4be053de3c..d1b15267ac81 100644 --- a/arch/h8300/kernel/h8300_ksyms.c +++ b/arch/h8300/kernel/h8300_ksyms.c | |||
@@ -39,7 +39,7 @@ EXPORT_SYMBOL(enable_irq); | |||
39 | EXPORT_SYMBOL(disable_irq); | 39 | EXPORT_SYMBOL(disable_irq); |
40 | 40 | ||
41 | /* Networking helper routines. */ | 41 | /* Networking helper routines. */ |
42 | EXPORT_SYMBOL(csum_partial_copy); | 42 | EXPORT_SYMBOL(csum_partial_copy_nocheck); |
43 | 43 | ||
44 | /* The following are special because they're not called | 44 | /* The following are special because they're not called |
45 | explicitly (the C compiler generates them). Fortunately, | 45 | explicitly (the C compiler generates them). Fortunately, |
diff --git a/arch/h8300/lib/checksum.c b/arch/h8300/lib/checksum.c index 5aa688d9242d..bdc5b032acd6 100644 --- a/arch/h8300/lib/checksum.c +++ b/arch/h8300/lib/checksum.c | |||
@@ -96,9 +96,9 @@ out: | |||
96 | * This is a version of ip_compute_csum() optimized for IP headers, | 96 | * This is a version of ip_compute_csum() optimized for IP headers, |
97 | * which always checksum on 4 octet boundaries. | 97 | * which always checksum on 4 octet boundaries. |
98 | */ | 98 | */ |
99 | unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl) | 99 | __sum16 ip_fast_csum(const void *iph, unsigned int ihl) |
100 | { | 100 | { |
101 | return ~do_csum(iph,ihl*4); | 101 | return (__force __sum16)~do_csum(iph,ihl*4); |
102 | } | 102 | } |
103 | 103 | ||
104 | /* | 104 | /* |
@@ -113,15 +113,19 @@ unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl) | |||
113 | * | 113 | * |
114 | * it's best to have buff aligned on a 32-bit boundary | 114 | * it's best to have buff aligned on a 32-bit boundary |
115 | */ | 115 | */ |
116 | unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum) | 116 | /* |
117 | * Egads... That thing apparently assumes that *all* checksums it ever sees will | ||
118 | * be folded. Very likely a bug. | ||
119 | */ | ||
120 | __wsum csum_partial(const void *buff, int len, __wsum sum) | ||
117 | { | 121 | { |
118 | unsigned int result = do_csum(buff, len); | 122 | unsigned int result = do_csum(buff, len); |
119 | 123 | ||
120 | /* add in old sum, and carry.. */ | 124 | /* add in old sum, and carry.. */ |
121 | result += sum; | 125 | result += (__force u32)sum; |
122 | /* 16+c bits -> 16 bits */ | 126 | /* 16+c bits -> 16 bits */ |
123 | result = (result & 0xffff) + (result >> 16); | 127 | result = (result & 0xffff) + (result >> 16); |
124 | return result; | 128 | return (__force __wsum)result; |
125 | } | 129 | } |
126 | 130 | ||
127 | EXPORT_SYMBOL(csum_partial); | 131 | EXPORT_SYMBOL(csum_partial); |
@@ -130,20 +134,21 @@ EXPORT_SYMBOL(csum_partial); | |||
130 | * this routine is used for miscellaneous IP-like checksums, mainly | 134 | * this routine is used for miscellaneous IP-like checksums, mainly |
131 | * in icmp.c | 135 | * in icmp.c |
132 | */ | 136 | */ |
133 | unsigned short ip_compute_csum(const unsigned char * buff, int len) | 137 | __sum16 ip_compute_csum(const void *buff, int len) |
134 | { | 138 | { |
135 | return ~do_csum(buff,len); | 139 | return (__force __sum16)~do_csum(buff,len); |
136 | } | 140 | } |
137 | 141 | ||
138 | /* | 142 | /* |
139 | * copy from fs while checksumming, otherwise like csum_partial | 143 | * copy from fs while checksumming, otherwise like csum_partial |
140 | */ | 144 | */ |
141 | 145 | ||
142 | unsigned int | 146 | __wsum |
143 | csum_partial_copy_from_user(const char *src, char *dst, int len, int sum, int *csum_err) | 147 | csum_partial_copy_from_user(const void __user *src, void *dst, int len, |
148 | __wsum sum, int *csum_err) | ||
144 | { | 149 | { |
145 | if (csum_err) *csum_err = 0; | 150 | if (csum_err) *csum_err = 0; |
146 | memcpy(dst, src, len); | 151 | memcpy(dst, (__force const void *)src, len); |
147 | return csum_partial(dst, len, sum); | 152 | return csum_partial(dst, len, sum); |
148 | } | 153 | } |
149 | 154 | ||
@@ -151,8 +156,8 @@ csum_partial_copy_from_user(const char *src, char *dst, int len, int sum, int *c | |||
151 | * copy from ds while checksumming, otherwise like csum_partial | 156 | * copy from ds while checksumming, otherwise like csum_partial |
152 | */ | 157 | */ |
153 | 158 | ||
154 | unsigned int | 159 | __wsum |
155 | csum_partial_copy(const char *src, char *dst, int len, int sum) | 160 | csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum) |
156 | { | 161 | { |
157 | memcpy(dst, src, len); | 162 | memcpy(dst, src, len); |
158 | return csum_partial(dst, len, sum); | 163 | return csum_partial(dst, len, sum); |