Re: [PATCH] net: fix comparisons of unsigned < 0

2007-05-31 Thread David Miller
From: Bill Nottingham <[EMAIL PROTECTED]>
Date: Wed, 30 May 2007 03:56:13 -0400

> Recent gcc versions emit warnings when unsigned variables are compared < 0 or 
> >= 0.
> 
> Signed-off-by: Bill Nottingham <[EMAIL PROTECTED]>

Patch applied, thanks.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] net: fix comparisons of unsigned 0

2007-05-31 Thread David Miller
From: Bill Nottingham [EMAIL PROTECTED]
Date: Wed, 30 May 2007 03:56:13 -0400

 Recent gcc versions emit warnings when unsigned variables are compared  0 or 
 = 0.
 
 Signed-off-by: Bill Nottingham [EMAIL PROTECTED]

Patch applied, thanks.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] net: fix comparisons of unsigned < 0

2007-05-30 Thread Bill Nottingham
Recent gcc versions emit warnings when unsigned variables are compared < 0 or 
>= 0.

Signed-off-by: Bill Nottingham <[EMAIL PROTECTED]>

---

 8021q/vlan.c   |3 +--
 dccp/probe.c   |2 +-
 ipv6/netfilter/nf_conntrack_l3proto_ipv6.c |3 +--
 ipv6/netfilter/nf_conntrack_proto_icmpv6.c |3 +--
 sched/act_pedit.c  |3 +--
 sctp/debug.c   |8 
 sctp/sm_statetable.c   |2 +-
 wanrouter/wanmain.c|2 +-
 8 files changed, 7 insertions(+), 19 deletions(-)

diff -ru linux-2.6.21-old/net/8021q/vlan.c linux-2.6.21/net/8021q/vlan.c
--- linux-2.6.21-old/net/8021q/vlan.c   2007-05-30 02:53:04.0 -0400
+++ linux-2.6.21/net/8021q/vlan.c   2007-05-30 02:35:47.0 -0400
@@ -740,8 +740,7 @@
case SET_VLAN_NAME_TYPE_CMD:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
-   if ((args.u.name_type >= 0) &&
-   (args.u.name_type < VLAN_NAME_TYPE_HIGHEST)) {
+   if (args.u.name_type < VLAN_NAME_TYPE_HIGHEST) {
vlan_name_type = args.u.name_type;
err = 0;
} else {
diff -ru linux-2.6.21-old/net/dccp/probe.c linux-2.6.21/net/dccp/probe.c
--- linux-2.6.21-old/net/dccp/probe.c   2007-05-30 02:53:04.0 -0400
+++ linux-2.6.21/net/dccp/probe.c   2007-05-30 02:36:09.0 -0400
@@ -128,7 +128,7 @@
int error = 0, cnt = 0;
unsigned char *tbuf;
 
-   if (!buf || len < 0)
+   if (!buf)
return -EINVAL;
 
if (len == 0)
diff -ru linux-2.6.21-old/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c 
linux-2.6.21/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
--- linux-2.6.21-old/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c 
2007-05-30 02:53:04.0 -0400
+++ linux-2.6.21/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c 2007-05-30 
02:36:44.0 -0400
@@ -177,8 +177,7 @@
 
protoff = nf_ct_ipv6_skip_exthdr(*pskb, extoff, ,
 (*pskb)->len - extoff);
-   if (protoff < 0 || protoff > (*pskb)->len ||
-   pnum == NEXTHDR_FRAGMENT) {
+   if (protoff > (*pskb)->len || pnum == NEXTHDR_FRAGMENT) {
DEBUGP("proto header not found\n");
return NF_ACCEPT;
}
diff -ru linux-2.6.21-old/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c 
linux-2.6.21/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
--- linux-2.6.21-old/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c 
2007-05-30 02:53:04.0 -0400
+++ linux-2.6.21/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c 2007-05-30 
02:37:04.0 -0400
@@ -168,8 +168,7 @@
   skb->len - inip6off
- sizeof(struct ipv6hdr));
 
-   if ((inprotoff < 0) || (inprotoff > skb->len) ||
-   (inprotonum == NEXTHDR_FRAGMENT)) {
+   if ((inprotoff > skb->len) || (inprotonum == NEXTHDR_FRAGMENT)) {
DEBUGP("icmpv6_error: Can't get protocol header in ICMPv6 
payload.\n");
return -NF_ACCEPT;
}
diff -ru linux-2.6.21-old/net/sched/act_pedit.c 
linux-2.6.21/net/sched/act_pedit.c
--- linux-2.6.21-old/net/sched/act_pedit.c  2007-05-30 02:53:04.0 
-0400
+++ linux-2.6.21/net/sched/act_pedit.c  2007-05-30 02:38:19.0 -0400
@@ -164,8 +164,7 @@
printk("offset must be on 32 bit boundaries\n");
goto bad;
}
-   if (skb->len < 0 ||
-   (offset > 0 && offset > skb->len)) {
+   if (offset > 0 && offset > skb->len) {
printk("offset %d cant exceed pkt length %d\n",
   offset, skb->len);
goto bad;
diff -ru linux-2.6.21-old/net/sctp/debug.c linux-2.6.21/net/sctp/debug.c
--- linux-2.6.21-old/net/sctp/debug.c   2007-05-30 02:53:04.0 -0400
+++ linux-2.6.21/net/sctp/debug.c   2007-05-30 02:39:29.0 -0400
@@ -77,8 +77,6 @@
 /* Lookup "chunk type" debug name. */
 const char *sctp_cname(const sctp_subtype_t cid)
 {
-   if (cid.chunk < 0)
-   return "illegal chunk id";
if (cid.chunk <= SCTP_CID_BASE_MAX)
return sctp_cid_tbl[cid.chunk];
 
@@ -146,8 +144,6 @@
 /* Lookup primitive debug name. */
 const char *sctp_pname(const sctp_subtype_t id)
 {
-   if (id.primitive < 0)
-   return "illegal primitive";
if (id.primitive <= SCTP_EVENT_PRIMITIVE_MAX)
return sctp_primitive_tbl[id.primitive];
return "unknown_primitive";
@@ -161,8 +157,6 @@
 /* Lookup "other" debug name. */
 const char *sctp_oname(const sctp_subtype_t id)
 {
-   if (id.other < 

[PATCH] net: fix comparisons of unsigned 0

2007-05-30 Thread Bill Nottingham
Recent gcc versions emit warnings when unsigned variables are compared  0 or 
= 0.

Signed-off-by: Bill Nottingham [EMAIL PROTECTED]

---

 8021q/vlan.c   |3 +--
 dccp/probe.c   |2 +-
 ipv6/netfilter/nf_conntrack_l3proto_ipv6.c |3 +--
 ipv6/netfilter/nf_conntrack_proto_icmpv6.c |3 +--
 sched/act_pedit.c  |3 +--
 sctp/debug.c   |8 
 sctp/sm_statetable.c   |2 +-
 wanrouter/wanmain.c|2 +-
 8 files changed, 7 insertions(+), 19 deletions(-)

diff -ru linux-2.6.21-old/net/8021q/vlan.c linux-2.6.21/net/8021q/vlan.c
--- linux-2.6.21-old/net/8021q/vlan.c   2007-05-30 02:53:04.0 -0400
+++ linux-2.6.21/net/8021q/vlan.c   2007-05-30 02:35:47.0 -0400
@@ -740,8 +740,7 @@
case SET_VLAN_NAME_TYPE_CMD:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
-   if ((args.u.name_type = 0) 
-   (args.u.name_type  VLAN_NAME_TYPE_HIGHEST)) {
+   if (args.u.name_type  VLAN_NAME_TYPE_HIGHEST) {
vlan_name_type = args.u.name_type;
err = 0;
} else {
diff -ru linux-2.6.21-old/net/dccp/probe.c linux-2.6.21/net/dccp/probe.c
--- linux-2.6.21-old/net/dccp/probe.c   2007-05-30 02:53:04.0 -0400
+++ linux-2.6.21/net/dccp/probe.c   2007-05-30 02:36:09.0 -0400
@@ -128,7 +128,7 @@
int error = 0, cnt = 0;
unsigned char *tbuf;
 
-   if (!buf || len  0)
+   if (!buf)
return -EINVAL;
 
if (len == 0)
diff -ru linux-2.6.21-old/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c 
linux-2.6.21/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
--- linux-2.6.21-old/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c 
2007-05-30 02:53:04.0 -0400
+++ linux-2.6.21/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c 2007-05-30 
02:36:44.0 -0400
@@ -177,8 +177,7 @@
 
protoff = nf_ct_ipv6_skip_exthdr(*pskb, extoff, pnum,
 (*pskb)-len - extoff);
-   if (protoff  0 || protoff  (*pskb)-len ||
-   pnum == NEXTHDR_FRAGMENT) {
+   if (protoff  (*pskb)-len || pnum == NEXTHDR_FRAGMENT) {
DEBUGP(proto header not found\n);
return NF_ACCEPT;
}
diff -ru linux-2.6.21-old/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c 
linux-2.6.21/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
--- linux-2.6.21-old/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c 
2007-05-30 02:53:04.0 -0400
+++ linux-2.6.21/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c 2007-05-30 
02:37:04.0 -0400
@@ -168,8 +168,7 @@
   skb-len - inip6off
- sizeof(struct ipv6hdr));
 
-   if ((inprotoff  0) || (inprotoff  skb-len) ||
-   (inprotonum == NEXTHDR_FRAGMENT)) {
+   if ((inprotoff  skb-len) || (inprotonum == NEXTHDR_FRAGMENT)) {
DEBUGP(icmpv6_error: Can't get protocol header in ICMPv6 
payload.\n);
return -NF_ACCEPT;
}
diff -ru linux-2.6.21-old/net/sched/act_pedit.c 
linux-2.6.21/net/sched/act_pedit.c
--- linux-2.6.21-old/net/sched/act_pedit.c  2007-05-30 02:53:04.0 
-0400
+++ linux-2.6.21/net/sched/act_pedit.c  2007-05-30 02:38:19.0 -0400
@@ -164,8 +164,7 @@
printk(offset must be on 32 bit boundaries\n);
goto bad;
}
-   if (skb-len  0 ||
-   (offset  0  offset  skb-len)) {
+   if (offset  0  offset  skb-len) {
printk(offset %d cant exceed pkt length %d\n,
   offset, skb-len);
goto bad;
diff -ru linux-2.6.21-old/net/sctp/debug.c linux-2.6.21/net/sctp/debug.c
--- linux-2.6.21-old/net/sctp/debug.c   2007-05-30 02:53:04.0 -0400
+++ linux-2.6.21/net/sctp/debug.c   2007-05-30 02:39:29.0 -0400
@@ -77,8 +77,6 @@
 /* Lookup chunk type debug name. */
 const char *sctp_cname(const sctp_subtype_t cid)
 {
-   if (cid.chunk  0)
-   return illegal chunk id;
if (cid.chunk = SCTP_CID_BASE_MAX)
return sctp_cid_tbl[cid.chunk];
 
@@ -146,8 +144,6 @@
 /* Lookup primitive debug name. */
 const char *sctp_pname(const sctp_subtype_t id)
 {
-   if (id.primitive  0)
-   return illegal primitive;
if (id.primitive = SCTP_EVENT_PRIMITIVE_MAX)
return sctp_primitive_tbl[id.primitive];
return unknown_primitive;
@@ -161,8 +157,6 @@
 /* Lookup other debug name. */
 const char *sctp_oname(const sctp_subtype_t id)
 {
-   if (id.other  0)
-   return illegal 'other' event;