diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-11-15 00:24:49 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:23:27 -0500 |
commit | d3bc23e7ee9db8023dff5a86bb3b0069ed018789 (patch) | |
tree | f281b190a20084386666e0f3bb957df427b93ca7 | |
parent | 9981a0e36a572e9fcf84bfab915fdc93bed0e3c9 (diff) |
[NET]: Annotate callers of csum_fold() in net/*
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/core/datagram.c | 8 | ||||
-rw-r--r-- | net/core/dev.c | 4 | ||||
-rw-r--r-- | net/core/netpoll.c | 2 | ||||
-rw-r--r-- | net/core/skbuff.c | 4 | ||||
-rw-r--r-- | net/ipv4/icmp.c | 4 | ||||
-rw-r--r-- | net/ipv4/igmp.c | 2 | ||||
-rw-r--r-- | net/ipv4/ip_gre.c | 4 | ||||
-rw-r--r-- | net/ipv4/ip_output.c | 2 | ||||
-rw-r--r-- | net/ipv4/ipmr.c | 2 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_core.c | 2 | ||||
-rw-r--r-- | net/ipv4/netfilter.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp.c | 8 | ||||
-rw-r--r-- | net/sunrpc/socklib.c | 2 |
13 files changed, 24 insertions, 22 deletions
diff --git a/net/core/datagram.c b/net/core/datagram.c index f558c61aecc7..e5a05a046fef 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c | |||
@@ -413,9 +413,9 @@ fault: | |||
413 | 413 | ||
414 | unsigned int __skb_checksum_complete(struct sk_buff *skb) | 414 | unsigned int __skb_checksum_complete(struct sk_buff *skb) |
415 | { | 415 | { |
416 | unsigned int sum; | 416 | __sum16 sum; |
417 | 417 | ||
418 | sum = (u16)csum_fold(skb_checksum(skb, 0, skb->len, skb->csum)); | 418 | sum = csum_fold(skb_checksum(skb, 0, skb->len, skb->csum)); |
419 | if (likely(!sum)) { | 419 | if (likely(!sum)) { |
420 | if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE)) | 420 | if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE)) |
421 | netdev_rx_csum_fault(skb->dev); | 421 | netdev_rx_csum_fault(skb->dev); |
@@ -441,7 +441,7 @@ EXPORT_SYMBOL(__skb_checksum_complete); | |||
441 | int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb, | 441 | int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb, |
442 | int hlen, struct iovec *iov) | 442 | int hlen, struct iovec *iov) |
443 | { | 443 | { |
444 | unsigned int csum; | 444 | __wsum csum; |
445 | int chunk = skb->len - hlen; | 445 | int chunk = skb->len - hlen; |
446 | 446 | ||
447 | /* Skip filled elements. | 447 | /* Skip filled elements. |
@@ -460,7 +460,7 @@ int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb, | |||
460 | if (skb_copy_and_csum_datagram(skb, hlen, iov->iov_base, | 460 | if (skb_copy_and_csum_datagram(skb, hlen, iov->iov_base, |
461 | chunk, &csum)) | 461 | chunk, &csum)) |
462 | goto fault; | 462 | goto fault; |
463 | if ((unsigned short)csum_fold(csum)) | 463 | if (csum_fold(csum)) |
464 | goto csum_error; | 464 | goto csum_error; |
465 | if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE)) | 465 | if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE)) |
466 | netdev_rx_csum_fault(skb->dev); | 466 | netdev_rx_csum_fault(skb->dev); |
diff --git a/net/core/dev.c b/net/core/dev.c index a7be106d0fdb..1a36b17f4b51 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1169,7 +1169,7 @@ EXPORT_SYMBOL(netif_device_attach); | |||
1169 | */ | 1169 | */ |
1170 | int skb_checksum_help(struct sk_buff *skb) | 1170 | int skb_checksum_help(struct sk_buff *skb) |
1171 | { | 1171 | { |
1172 | unsigned int csum; | 1172 | __wsum csum; |
1173 | int ret = 0, offset = skb->h.raw - skb->data; | 1173 | int ret = 0, offset = skb->h.raw - skb->data; |
1174 | 1174 | ||
1175 | if (skb->ip_summed == CHECKSUM_COMPLETE) | 1175 | if (skb->ip_summed == CHECKSUM_COMPLETE) |
@@ -1193,7 +1193,7 @@ int skb_checksum_help(struct sk_buff *skb) | |||
1193 | BUG_ON(offset <= 0); | 1193 | BUG_ON(offset <= 0); |
1194 | BUG_ON(skb->csum + 2 > offset); | 1194 | BUG_ON(skb->csum + 2 > offset); |
1195 | 1195 | ||
1196 | *(u16*)(skb->h.raw + skb->csum) = csum_fold(csum); | 1196 | *(__sum16*)(skb->h.raw + skb->csum) = csum_fold(csum); |
1197 | 1197 | ||
1198 | out_set_summed: | 1198 | out_set_summed: |
1199 | skb->ip_summed = CHECKSUM_NONE; | 1199 | skb->ip_summed = CHECKSUM_NONE; |
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 523141ee920c..edd3246873e8 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -88,7 +88,7 @@ static int checksum_udp(struct sk_buff *skb, struct udphdr *uh, | |||
88 | psum = csum_tcpudp_nofold(saddr, daddr, ulen, IPPROTO_UDP, 0); | 88 | psum = csum_tcpudp_nofold(saddr, daddr, ulen, IPPROTO_UDP, 0); |
89 | 89 | ||
90 | if (skb->ip_summed == CHECKSUM_COMPLETE && | 90 | if (skb->ip_summed == CHECKSUM_COMPLETE && |
91 | !(u16)csum_fold(csum_add(psum, skb->csum))) | 91 | !csum_fold(csum_add(psum, skb->csum))) |
92 | return 0; | 92 | return 0; |
93 | 93 | ||
94 | skb->csum = psum; | 94 | skb->csum = psum; |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index b3dea1ef9535..dfa02cc8d687 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -1396,7 +1396,7 @@ unsigned int skb_copy_and_csum_bits(const struct sk_buff *skb, int offset, | |||
1396 | 1396 | ||
1397 | void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to) | 1397 | void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to) |
1398 | { | 1398 | { |
1399 | unsigned int csum; | 1399 | __wsum csum; |
1400 | long csstart; | 1400 | long csstart; |
1401 | 1401 | ||
1402 | if (skb->ip_summed == CHECKSUM_PARTIAL) | 1402 | if (skb->ip_summed == CHECKSUM_PARTIAL) |
@@ -1416,7 +1416,7 @@ void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to) | |||
1416 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 1416 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
1417 | long csstuff = csstart + skb->csum; | 1417 | long csstuff = csstart + skb->csum; |
1418 | 1418 | ||
1419 | *((unsigned short *)(to + csstuff)) = csum_fold(csum); | 1419 | *((__sum16 *)(to + csstuff)) = csum_fold(csum); |
1420 | } | 1420 | } |
1421 | } | 1421 | } |
1422 | 1422 | ||
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index b39a37a47545..cb9da0842b77 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c | |||
@@ -356,7 +356,7 @@ static void icmp_push_reply(struct icmp_bxm *icmp_param, | |||
356 | ip_flush_pending_frames(icmp_socket->sk); | 356 | ip_flush_pending_frames(icmp_socket->sk); |
357 | else if ((skb = skb_peek(&icmp_socket->sk->sk_write_queue)) != NULL) { | 357 | else if ((skb = skb_peek(&icmp_socket->sk->sk_write_queue)) != NULL) { |
358 | struct icmphdr *icmph = skb->h.icmph; | 358 | struct icmphdr *icmph = skb->h.icmph; |
359 | unsigned int csum = 0; | 359 | __wsum csum = 0; |
360 | struct sk_buff *skb1; | 360 | struct sk_buff *skb1; |
361 | 361 | ||
362 | skb_queue_walk(&icmp_socket->sk->sk_write_queue, skb1) { | 362 | skb_queue_walk(&icmp_socket->sk->sk_write_queue, skb1) { |
@@ -931,7 +931,7 @@ int icmp_rcv(struct sk_buff *skb) | |||
931 | 931 | ||
932 | switch (skb->ip_summed) { | 932 | switch (skb->ip_summed) { |
933 | case CHECKSUM_COMPLETE: | 933 | case CHECKSUM_COMPLETE: |
934 | if (!(u16)csum_fold(skb->csum)) | 934 | if (!csum_fold(skb->csum)) |
935 | break; | 935 | break; |
936 | /* fall through */ | 936 | /* fall through */ |
937 | case CHECKSUM_NONE: | 937 | case CHECKSUM_NONE: |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 6eee71647b7c..0017ccb01d6d 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -932,7 +932,7 @@ int igmp_rcv(struct sk_buff *skb) | |||
932 | 932 | ||
933 | switch (skb->ip_summed) { | 933 | switch (skb->ip_summed) { |
934 | case CHECKSUM_COMPLETE: | 934 | case CHECKSUM_COMPLETE: |
935 | if (!(u16)csum_fold(skb->csum)) | 935 | if (!csum_fold(skb->csum)) |
936 | break; | 936 | break; |
937 | /* fall through */ | 937 | /* fall through */ |
938 | case CHECKSUM_NONE: | 938 | case CHECKSUM_NONE: |
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 25221146debb..2bf54adee8c2 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -557,7 +557,7 @@ static int ipgre_rcv(struct sk_buff *skb) | |||
557 | struct iphdr *iph; | 557 | struct iphdr *iph; |
558 | u8 *h; | 558 | u8 *h; |
559 | __be16 flags; | 559 | __be16 flags; |
560 | u16 csum = 0; | 560 | __sum16 csum = 0; |
561 | __be32 key = 0; | 561 | __be32 key = 0; |
562 | u32 seqno = 0; | 562 | u32 seqno = 0; |
563 | struct ip_tunnel *tunnel; | 563 | struct ip_tunnel *tunnel; |
@@ -580,7 +580,7 @@ static int ipgre_rcv(struct sk_buff *skb) | |||
580 | if (flags&GRE_CSUM) { | 580 | if (flags&GRE_CSUM) { |
581 | switch (skb->ip_summed) { | 581 | switch (skb->ip_summed) { |
582 | case CHECKSUM_COMPLETE: | 582 | case CHECKSUM_COMPLETE: |
583 | csum = (u16)csum_fold(skb->csum); | 583 | csum = csum_fold(skb->csum); |
584 | if (!csum) | 584 | if (!csum) |
585 | break; | 585 | break; |
586 | /* fall through */ | 586 | /* fall through */ |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 90942a384a45..5f3e35c03637 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -1384,7 +1384,7 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar | |||
1384 | &ipc, rt, MSG_DONTWAIT); | 1384 | &ipc, rt, MSG_DONTWAIT); |
1385 | if ((skb = skb_peek(&sk->sk_write_queue)) != NULL) { | 1385 | if ((skb = skb_peek(&sk->sk_write_queue)) != NULL) { |
1386 | if (arg->csumoffset >= 0) | 1386 | if (arg->csumoffset >= 0) |
1387 | *((u16 *)skb->h.raw + arg->csumoffset) = csum_fold(csum_add(skb->csum, arg->csum)); | 1387 | *((__sum16 *)skb->h.raw + arg->csumoffset) = csum_fold(csum_add(skb->csum, arg->csum)); |
1388 | skb->ip_summed = CHECKSUM_NONE; | 1388 | skb->ip_summed = CHECKSUM_NONE; |
1389 | ip_push_pending_frames(sk); | 1389 | ip_push_pending_frames(sk); |
1390 | } | 1390 | } |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 97cfa97c8abb..efcf45ecc818 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -1493,7 +1493,7 @@ static int pim_rcv(struct sk_buff * skb) | |||
1493 | if (pim->type != ((PIM_VERSION<<4)|(PIM_REGISTER)) || | 1493 | if (pim->type != ((PIM_VERSION<<4)|(PIM_REGISTER)) || |
1494 | (pim->flags&PIM_NULL_REGISTER) || | 1494 | (pim->flags&PIM_NULL_REGISTER) || |
1495 | (ip_compute_csum((void *)pim, sizeof(*pim)) != 0 && | 1495 | (ip_compute_csum((void *)pim, sizeof(*pim)) != 0 && |
1496 | (u16)csum_fold(skb_checksum(skb, 0, skb->len, 0)))) | 1496 | csum_fold(skb_checksum(skb, 0, skb->len, 0)))) |
1497 | goto drop; | 1497 | goto drop; |
1498 | 1498 | ||
1499 | /* check if the inner packet is destined to mcast group */ | 1499 | /* check if the inner packet is destined to mcast group */ |
diff --git a/net/ipv4/ipvs/ip_vs_core.c b/net/ipv4/ipvs/ip_vs_core.c index 1445bb47fea4..fac2dffd6672 100644 --- a/net/ipv4/ipvs/ip_vs_core.c +++ b/net/ipv4/ipvs/ip_vs_core.c | |||
@@ -538,7 +538,7 @@ static unsigned int ip_vs_post_routing(unsigned int hooknum, | |||
538 | 538 | ||
539 | u16 ip_vs_checksum_complete(struct sk_buff *skb, int offset) | 539 | u16 ip_vs_checksum_complete(struct sk_buff *skb, int offset) |
540 | { | 540 | { |
541 | return (u16) csum_fold(skb_checksum(skb, offset, skb->len - offset, 0)); | 541 | return csum_fold(skb_checksum(skb, offset, skb->len - offset, 0)); |
542 | } | 542 | } |
543 | 543 | ||
544 | static inline struct sk_buff * | 544 | static inline struct sk_buff * |
diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c index e49441ac3571..b797a37c01ce 100644 --- a/net/ipv4/netfilter.c +++ b/net/ipv4/netfilter.c | |||
@@ -172,7 +172,7 @@ unsigned int nf_ip_checksum(struct sk_buff *skb, unsigned int hook, | |||
172 | case CHECKSUM_COMPLETE: | 172 | case CHECKSUM_COMPLETE: |
173 | if (hook != NF_IP_PRE_ROUTING && hook != NF_IP_LOCAL_IN) | 173 | if (hook != NF_IP_PRE_ROUTING && hook != NF_IP_LOCAL_IN) |
174 | break; | 174 | break; |
175 | if ((protocol == 0 && !(u16)csum_fold(skb->csum)) || | 175 | if ((protocol == 0 && !csum_fold(skb->csum)) || |
176 | !csum_tcpudp_magic(iph->saddr, iph->daddr, | 176 | !csum_tcpudp_magic(iph->saddr, iph->daddr, |
177 | skb->len - dataoff, protocol, | 177 | skb->len - dataoff, protocol, |
178 | skb->csum)) { | 178 | skb->csum)) { |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index dadef867a3bb..168f9de906bc 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -2162,7 +2162,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features) | |||
2162 | struct tcphdr *th; | 2162 | struct tcphdr *th; |
2163 | unsigned thlen; | 2163 | unsigned thlen; |
2164 | unsigned int seq; | 2164 | unsigned int seq; |
2165 | unsigned int delta; | 2165 | __be32 delta; |
2166 | unsigned int oldlen; | 2166 | unsigned int oldlen; |
2167 | unsigned int len; | 2167 | unsigned int len; |
2168 | 2168 | ||
@@ -2215,7 +2215,8 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features) | |||
2215 | do { | 2215 | do { |
2216 | th->fin = th->psh = 0; | 2216 | th->fin = th->psh = 0; |
2217 | 2217 | ||
2218 | th->check = ~csum_fold(th->check + delta); | 2218 | th->check = ~csum_fold((__force __wsum)((__force u32)th->check + |
2219 | (__force u32)delta)); | ||
2219 | if (skb->ip_summed != CHECKSUM_PARTIAL) | 2220 | if (skb->ip_summed != CHECKSUM_PARTIAL) |
2220 | th->check = csum_fold(csum_partial(skb->h.raw, thlen, | 2221 | th->check = csum_fold(csum_partial(skb->h.raw, thlen, |
2221 | skb->csum)); | 2222 | skb->csum)); |
@@ -2229,7 +2230,8 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features) | |||
2229 | } while (skb->next); | 2230 | } while (skb->next); |
2230 | 2231 | ||
2231 | delta = htonl(oldlen + (skb->tail - skb->h.raw) + skb->data_len); | 2232 | delta = htonl(oldlen + (skb->tail - skb->h.raw) + skb->data_len); |
2232 | th->check = ~csum_fold(th->check + delta); | 2233 | th->check = ~csum_fold((__force __wsum)((__force u32)th->check + |
2234 | (__force u32)delta)); | ||
2233 | if (skb->ip_summed != CHECKSUM_PARTIAL) | 2235 | if (skb->ip_summed != CHECKSUM_PARTIAL) |
2234 | th->check = csum_fold(csum_partial(skb->h.raw, thlen, | 2236 | th->check = csum_fold(csum_partial(skb->h.raw, thlen, |
2235 | skb->csum)); | 2237 | skb->csum)); |
diff --git a/net/sunrpc/socklib.c b/net/sunrpc/socklib.c index 6f17527b9e69..61a038fc30cf 100644 --- a/net/sunrpc/socklib.c +++ b/net/sunrpc/socklib.c | |||
@@ -166,7 +166,7 @@ int csum_partial_copy_to_xdr(struct xdr_buf *xdr, struct sk_buff *skb) | |||
166 | } | 166 | } |
167 | if (desc.count) | 167 | if (desc.count) |
168 | return -1; | 168 | return -1; |
169 | if ((unsigned short)csum_fold(desc.csum)) | 169 | if (csum_fold(desc.csum)) |
170 | return -1; | 170 | return -1; |
171 | if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE)) | 171 | if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE)) |
172 | netdev_rx_csum_fault(skb->dev); | 172 | netdev_rx_csum_fault(skb->dev); |