aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-11-15 00:24:49 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:23:27 -0500
commitd3bc23e7ee9db8023dff5a86bb3b0069ed018789 (patch)
treef281b190a20084386666e0f3bb957df427b93ca7 /net/ipv4
parent9981a0e36a572e9fcf84bfab915fdc93bed0e3c9 (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>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/icmp.c4
-rw-r--r--net/ipv4/igmp.c2
-rw-r--r--net/ipv4/ip_gre.c4
-rw-r--r--net/ipv4/ip_output.c2
-rw-r--r--net/ipv4/ipmr.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_core.c2
-rw-r--r--net/ipv4/netfilter.c2
-rw-r--r--net/ipv4/tcp.c8
8 files changed, 14 insertions, 12 deletions
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
539u16 ip_vs_checksum_complete(struct sk_buff *skb, int offset) 539u16 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
544static inline struct sk_buff * 544static 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));