Netdev List
 help / color / mirror / Atom feed
* [PATCH] ipvs: oldlen, newlen should be be16, not be32
@ 2008-11-07  2:12 Harvey Harrison
  2008-11-07  2:28 ` Simon Horman
  0 siblings, 1 reply; 3+ messages in thread
From: Harvey Harrison @ 2008-11-07  2:12 UTC (permalink / raw)
  To: David Miller; +Cc: linux-netdev

Noticed by sparse:
net/netfilter/ipvs/ip_vs_proto_tcp.c:195:6: warning: incorrect type in argument 5 (different base types)
net/netfilter/ipvs/ip_vs_proto_tcp.c:195:6:    expected restricted __be16 [usertype] oldlen
net/netfilter/ipvs/ip_vs_proto_tcp.c:195:6:    got restricted __be32 [usertype] <noident>
net/netfilter/ipvs/ip_vs_proto_tcp.c:196:6: warning: incorrect type in argument 6 (different base types)
net/netfilter/ipvs/ip_vs_proto_tcp.c:196:6:    expected restricted __be16 [usertype] newlen
net/netfilter/ipvs/ip_vs_proto_tcp.c:196:6:    got restricted __be32 [usertype] <noident>
net/netfilter/ipvs/ip_vs_proto_tcp.c:270:6: warning: incorrect type in argument 5 (different base types)
net/netfilter/ipvs/ip_vs_proto_tcp.c:270:6:    expected restricted __be16 [usertype] oldlen
net/netfilter/ipvs/ip_vs_proto_tcp.c:270:6:    got restricted __be32 [usertype] <noident>
net/netfilter/ipvs/ip_vs_proto_tcp.c:271:6: warning: incorrect type in argument 6 (different base types)
net/netfilter/ipvs/ip_vs_proto_tcp.c:271:6:    expected restricted __be16 [usertype] newlen
net/netfilter/ipvs/ip_vs_proto_tcp.c:271:6:    got restricted __be32 [usertype] <noident>
net/netfilter/ipvs/ip_vs_proto_udp.c:206:6: warning: incorrect type in argument 5 (different base types)
net/netfilter/ipvs/ip_vs_proto_udp.c:206:6:    expected restricted __be16 [usertype] oldlen
net/netfilter/ipvs/ip_vs_proto_udp.c:206:6:    got restricted __be32 [usertype] <noident>
net/netfilter/ipvs/ip_vs_proto_udp.c:207:6: warning: incorrect type in argument 6 (different base types)
net/netfilter/ipvs/ip_vs_proto_udp.c:207:6:    expected restricted __be16 [usertype] newlen
net/netfilter/ipvs/ip_vs_proto_udp.c:207:6:    got restricted __be32 [usertype] <noident>
net/netfilter/ipvs/ip_vs_proto_udp.c:282:6: warning: incorrect type in argument 5 (different base types)
net/netfilter/ipvs/ip_vs_proto_udp.c:282:6:    expected restricted __be16 [usertype] oldlen
net/netfilter/ipvs/ip_vs_proto_udp.c:282:6:    got restricted __be32 [usertype] <noident>
net/netfilter/ipvs/ip_vs_proto_udp.c:283:6: warning: incorrect type in argument 6 (different base types)
net/netfilter/ipvs/ip_vs_proto_udp.c:283:6:    expected restricted __be16 [usertype] newlen
net/netfilter/ipvs/ip_vs_proto_udp.c:283:6:    got restricted __be32 [usertype] <noident>

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
 net/netfilter/ipvs/ip_vs_proto_tcp.c |    8 ++++----
 net/netfilter/ipvs/ip_vs_proto_udp.c |    8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_proto_tcp.c b/net/netfilter/ipvs/ip_vs_proto_tcp.c
index dd4566e..8cba418 100644
--- a/net/netfilter/ipvs/ip_vs_proto_tcp.c
+++ b/net/netfilter/ipvs/ip_vs_proto_tcp.c
@@ -192,8 +192,8 @@ tcp_snat_handler(struct sk_buff *skb,
 	/* Adjust TCP checksums */
 	if (skb->ip_summed == CHECKSUM_PARTIAL) {
 		tcp_partial_csum_update(cp->af, tcph, &cp->daddr, &cp->vaddr,
-					htonl(oldlen),
-					htonl(skb->len - tcphoff));
+					htons(oldlen),
+					htons(skb->len - tcphoff));
 	} else if (!cp->app) {
 		/* Only port and addr are changed, do fast csum update */
 		tcp_fast_csum_update(cp->af, tcph, &cp->daddr, &cp->vaddr,
@@ -267,8 +267,8 @@ tcp_dnat_handler(struct sk_buff *skb,
 	 */
 	if (skb->ip_summed == CHECKSUM_PARTIAL) {
 		tcp_partial_csum_update(cp->af, tcph, &cp->daddr, &cp->vaddr,
-					htonl(oldlen),
-					htonl(skb->len - tcphoff));
+					htons(oldlen),
+					htons(skb->len - tcphoff));
 	} else if (!cp->app) {
 		/* Only port and addr are changed, do fast csum update */
 		tcp_fast_csum_update(cp->af, tcph, &cp->vaddr, &cp->daddr,
diff --git a/net/netfilter/ipvs/ip_vs_proto_udp.c b/net/netfilter/ipvs/ip_vs_proto_udp.c
index 6eb6039..d2930a7 100644
--- a/net/netfilter/ipvs/ip_vs_proto_udp.c
+++ b/net/netfilter/ipvs/ip_vs_proto_udp.c
@@ -203,8 +203,8 @@ udp_snat_handler(struct sk_buff *skb,
 	 */
 	if (skb->ip_summed == CHECKSUM_PARTIAL) {
 		udp_partial_csum_update(cp->af, udph, &cp->daddr, &cp->vaddr,
-					htonl(oldlen),
-					htonl(skb->len - udphoff));
+					htons(oldlen),
+					htons(skb->len - udphoff));
 	} else if (!cp->app && (udph->check != 0)) {
 		/* Only port and addr are changed, do fast csum update */
 		udp_fast_csum_update(cp->af, udph, &cp->daddr, &cp->vaddr,
@@ -279,8 +279,8 @@ udp_dnat_handler(struct sk_buff *skb,
 	 */
 	if (skb->ip_summed == CHECKSUM_PARTIAL) {
 		udp_partial_csum_update(cp->af, udph, &cp->daddr, &cp->vaddr,
-					htonl(oldlen),
-					htonl(skb->len - udphoff));
+					htons(oldlen),
+					htons(skb->len - udphoff));
 	} else if (!cp->app && (udph->check != 0)) {
 		/* Only port and addr are changed, do fast csum update */
 		udp_fast_csum_update(cp->af, udph, &cp->vaddr, &cp->daddr,
-- 
1.6.0.3.756.gb776d




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ipvs: oldlen, newlen should be be16, not be32
  2008-11-07  2:12 [PATCH] ipvs: oldlen, newlen should be be16, not be32 Harvey Harrison
@ 2008-11-07  2:28 ` Simon Horman
  2008-11-07  7:10   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Horman @ 2008-11-07  2:28 UTC (permalink / raw)
  To: Harvey Harrison; +Cc: David Miller, linux-netdev

On Thu, Nov 06, 2008 at 06:12:05PM -0800, Harvey Harrison wrote:
> Noticed by sparse:
> net/netfilter/ipvs/ip_vs_proto_tcp.c:195:6: warning: incorrect type in argument 5 (different base types)
> net/netfilter/ipvs/ip_vs_proto_tcp.c:195:6:    expected restricted __be16 [usertype] oldlen
> net/netfilter/ipvs/ip_vs_proto_tcp.c:195:6:    got restricted __be32 [usertype] <noident>
> net/netfilter/ipvs/ip_vs_proto_tcp.c:196:6: warning: incorrect type in argument 6 (different base types)
> net/netfilter/ipvs/ip_vs_proto_tcp.c:196:6:    expected restricted __be16 [usertype] newlen
> net/netfilter/ipvs/ip_vs_proto_tcp.c:196:6:    got restricted __be32 [usertype] <noident>
> net/netfilter/ipvs/ip_vs_proto_tcp.c:270:6: warning: incorrect type in argument 5 (different base types)
> net/netfilter/ipvs/ip_vs_proto_tcp.c:270:6:    expected restricted __be16 [usertype] oldlen
> net/netfilter/ipvs/ip_vs_proto_tcp.c:270:6:    got restricted __be32 [usertype] <noident>
> net/netfilter/ipvs/ip_vs_proto_tcp.c:271:6: warning: incorrect type in argument 6 (different base types)
> net/netfilter/ipvs/ip_vs_proto_tcp.c:271:6:    expected restricted __be16 [usertype] newlen
> net/netfilter/ipvs/ip_vs_proto_tcp.c:271:6:    got restricted __be32 [usertype] <noident>
> net/netfilter/ipvs/ip_vs_proto_udp.c:206:6: warning: incorrect type in argument 5 (different base types)
> net/netfilter/ipvs/ip_vs_proto_udp.c:206:6:    expected restricted __be16 [usertype] oldlen
> net/netfilter/ipvs/ip_vs_proto_udp.c:206:6:    got restricted __be32 [usertype] <noident>
> net/netfilter/ipvs/ip_vs_proto_udp.c:207:6: warning: incorrect type in argument 6 (different base types)
> net/netfilter/ipvs/ip_vs_proto_udp.c:207:6:    expected restricted __be16 [usertype] newlen
> net/netfilter/ipvs/ip_vs_proto_udp.c:207:6:    got restricted __be32 [usertype] <noident>
> net/netfilter/ipvs/ip_vs_proto_udp.c:282:6: warning: incorrect type in argument 5 (different base types)
> net/netfilter/ipvs/ip_vs_proto_udp.c:282:6:    expected restricted __be16 [usertype] oldlen
> net/netfilter/ipvs/ip_vs_proto_udp.c:282:6:    got restricted __be32 [usertype] <noident>
> net/netfilter/ipvs/ip_vs_proto_udp.c:283:6: warning: incorrect type in argument 6 (different base types)
> net/netfilter/ipvs/ip_vs_proto_udp.c:283:6:    expected restricted __be16 [usertype] newlen
> net/netfilter/ipvs/ip_vs_proto_udp.c:283:6:    got restricted __be32 [usertype] <noident>
> 
> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>

I suspect these were introduced by me :-(

Acked-by: Simon Horman <horms@verge.net.au>

> ---
>  net/netfilter/ipvs/ip_vs_proto_tcp.c |    8 ++++----
>  net/netfilter/ipvs/ip_vs_proto_udp.c |    8 ++++----
>  2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/net/netfilter/ipvs/ip_vs_proto_tcp.c b/net/netfilter/ipvs/ip_vs_proto_tcp.c
> index dd4566e..8cba418 100644
> --- a/net/netfilter/ipvs/ip_vs_proto_tcp.c
> +++ b/net/netfilter/ipvs/ip_vs_proto_tcp.c
> @@ -192,8 +192,8 @@ tcp_snat_handler(struct sk_buff *skb,
>  	/* Adjust TCP checksums */
>  	if (skb->ip_summed == CHECKSUM_PARTIAL) {
>  		tcp_partial_csum_update(cp->af, tcph, &cp->daddr, &cp->vaddr,
> -					htonl(oldlen),
> -					htonl(skb->len - tcphoff));
> +					htons(oldlen),
> +					htons(skb->len - tcphoff));
>  	} else if (!cp->app) {
>  		/* Only port and addr are changed, do fast csum update */
>  		tcp_fast_csum_update(cp->af, tcph, &cp->daddr, &cp->vaddr,
> @@ -267,8 +267,8 @@ tcp_dnat_handler(struct sk_buff *skb,
>  	 */
>  	if (skb->ip_summed == CHECKSUM_PARTIAL) {
>  		tcp_partial_csum_update(cp->af, tcph, &cp->daddr, &cp->vaddr,
> -					htonl(oldlen),
> -					htonl(skb->len - tcphoff));
> +					htons(oldlen),
> +					htons(skb->len - tcphoff));
>  	} else if (!cp->app) {
>  		/* Only port and addr are changed, do fast csum update */
>  		tcp_fast_csum_update(cp->af, tcph, &cp->vaddr, &cp->daddr,
> diff --git a/net/netfilter/ipvs/ip_vs_proto_udp.c b/net/netfilter/ipvs/ip_vs_proto_udp.c
> index 6eb6039..d2930a7 100644
> --- a/net/netfilter/ipvs/ip_vs_proto_udp.c
> +++ b/net/netfilter/ipvs/ip_vs_proto_udp.c
> @@ -203,8 +203,8 @@ udp_snat_handler(struct sk_buff *skb,
>  	 */
>  	if (skb->ip_summed == CHECKSUM_PARTIAL) {
>  		udp_partial_csum_update(cp->af, udph, &cp->daddr, &cp->vaddr,
> -					htonl(oldlen),
> -					htonl(skb->len - udphoff));
> +					htons(oldlen),
> +					htons(skb->len - udphoff));
>  	} else if (!cp->app && (udph->check != 0)) {
>  		/* Only port and addr are changed, do fast csum update */
>  		udp_fast_csum_update(cp->af, udph, &cp->daddr, &cp->vaddr,
> @@ -279,8 +279,8 @@ udp_dnat_handler(struct sk_buff *skb,
>  	 */
>  	if (skb->ip_summed == CHECKSUM_PARTIAL) {
>  		udp_partial_csum_update(cp->af, udph, &cp->daddr, &cp->vaddr,
> -					htonl(oldlen),
> -					htonl(skb->len - udphoff));
> +					htons(oldlen),
> +					htons(skb->len - udphoff));
>  	} else if (!cp->app && (udph->check != 0)) {
>  		/* Only port and addr are changed, do fast csum update */
>  		udp_fast_csum_update(cp->af, udph, &cp->vaddr, &cp->daddr,
> -- 
> 1.6.0.3.756.gb776d
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Simon Horman
  VA Linux Systems Japan K.K., Sydney, Australia Satellite Office
  H: www.vergenet.net/~horms/             W: www.valinux.co.jp/en


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ipvs: oldlen, newlen should be be16, not be32
  2008-11-07  2:28 ` Simon Horman
@ 2008-11-07  7:10   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2008-11-07  7:10 UTC (permalink / raw)
  To: horms; +Cc: harvey.harrison, netdev

From: Simon Horman <horms@verge.net.au>
Date: Fri, 7 Nov 2008 13:28:14 +1100

> On Thu, Nov 06, 2008 at 06:12:05PM -0800, Harvey Harrison wrote:
> > Noticed by sparse:
 ...
> > Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
> 
> I suspect these were introduced by me :-(
> 
> Acked-by: Simon Horman <horms@verge.net.au>

Applied to net-next-2.6, thanks everyone.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-11-07  7:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-07  2:12 [PATCH] ipvs: oldlen, newlen should be be16, not be32 Harvey Harrison
2008-11-07  2:28 ` Simon Horman
2008-11-07  7:10   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox