aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/utils.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-05-25 21:50:01 -0400
committerDavid S. Miller <davem@davemloft.net>2015-05-25 22:56:47 -0400
commit05c985436dfe81ab784251a54dd69be5b2dea98a (patch)
tree0e61f36f0c6548679395ac3b171150110164ade2 /net/core/utils.c
parent68319052d10d18462fbfd5571a5062cb7ec50788 (diff)
net: fix inet_proto_csum_replace4() sparse errors
make C=2 CF=-D__CHECK_ENDIAN__ net/core/utils.o ... net/core/utils.c:307:72: warning: incorrect type in argument 2 (different base types) net/core/utils.c:307:72: expected restricted __wsum [usertype] addend net/core/utils.c:307:72: got restricted __be32 [usertype] from net/core/utils.c:308:34: warning: incorrect type in argument 2 (different base types) net/core/utils.c:308:34: expected restricted __wsum [usertype] addend net/core/utils.c:308:34: got restricted __be32 [usertype] to net/core/utils.c:310:70: warning: incorrect type in argument 2 (different base types) net/core/utils.c:310:70: expected restricted __wsum [usertype] addend net/core/utils.c:310:70: got restricted __be32 [usertype] from net/core/utils.c:310:77: warning: incorrect type in argument 2 (different base types) net/core/utils.c:310:77: expected restricted __wsum [usertype] addend net/core/utils.c:310:77: got restricted __be32 [usertype] to net/core/utils.c:312:72: warning: incorrect type in argument 2 (different base types) net/core/utils.c:312:72: expected restricted __wsum [usertype] addend net/core/utils.c:312:72: got restricted __be32 [usertype] from net/core/utils.c:313:35: warning: incorrect type in argument 2 (different base types) net/core/utils.c:313:35: expected restricted __wsum [usertype] addend net/core/utils.c:313:35: got restricted __be32 [usertype] to Note we can use csum_replace4() helper Fixes: 58e3cac5613aa ("net: optimise inet_proto_csum_replace4()") Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/utils.c')
-rw-r--r--net/core/utils.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/net/core/utils.c b/net/core/utils.c
index 7b803884c162..a7732a068043 100644
--- a/net/core/utils.c
+++ b/net/core/utils.c
@@ -304,13 +304,15 @@ void inet_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
304 __be32 from, __be32 to, int pseudohdr) 304 __be32 from, __be32 to, int pseudohdr)
305{ 305{
306 if (skb->ip_summed != CHECKSUM_PARTIAL) { 306 if (skb->ip_summed != CHECKSUM_PARTIAL) {
307 *sum = csum_fold(csum_add(csum_sub(~csum_unfold(*sum), from), 307 csum_replace4(sum, from, to);
308 to));
309 if (skb->ip_summed == CHECKSUM_COMPLETE && pseudohdr) 308 if (skb->ip_summed == CHECKSUM_COMPLETE && pseudohdr)
310 skb->csum = ~csum_add(csum_sub(~(skb->csum), from), to); 309 skb->csum = ~csum_add(csum_sub(~(skb->csum),
310 (__force __wsum)from),
311 (__force __wsum)to);
311 } else if (pseudohdr) 312 } else if (pseudohdr)
312 *sum = ~csum_fold(csum_add(csum_sub(csum_unfold(*sum), from), 313 *sum = ~csum_fold(csum_add(csum_sub(csum_unfold(*sum),
313 to)); 314 (__force __wsum)from),
315 (__force __wsum)to));
314} 316}
315EXPORT_SYMBOL(inet_proto_csum_replace4); 317EXPORT_SYMBOL(inet_proto_csum_replace4);
316 318