summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2007-06-01 08:33:35 +0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-06-04 05:08:47 +0400
commit75202e76893c11ce7f8bcc9a07f994d71e3d5113 (patch)
tree71d9e0aaabb6b3904c477f8ee253484245e38d49
parent60468d5b5b6931b4d4d704e26b5f17a6e476e6f8 (diff)
downloadlinux-75202e76893c11ce7f8bcc9a07f994d71e3d5113.tar.xz
[NET]: Fix comparisons of unsigned < 0.
Recent gcc versions emit warnings when unsigned variables are compared < 0 or >= 0. Signed-off-by: Bill Nottingham <notting@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/8021q/vlan.c3
-rw-r--r--net/dccp/probe.c2
-rw-r--r--net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c3
-rw-r--r--net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c3
-rw-r--r--net/sched/act_pedit.c3
-rw-r--r--net/sctp/debug.c8
-rw-r--r--net/sctp/sm_statetable.c2
-rw-r--r--net/wanrouter/wanmain.c2
8 files changed, 7 insertions, 19 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index ceef57c9ab32..de78c9dd713b 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -736,8 +736,7 @@ static int vlan_ioctl_handler(void __user *arg)
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 --git a/net/dccp/probe.c b/net/dccp/probe.c
index 1f5e3ba62065..43a3adb027e7 100644
--- a/net/dccp/probe.c
+++ b/net/dccp/probe.c
@@ -128,7 +128,7 @@ static ssize_t dccpprobe_read(struct file *file, char __user *buf,
int error = 0, cnt = 0;
unsigned char *tbuf;
- if (!buf || len < 0)
+ if (!buf)
return -EINVAL;
if (len == 0)
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
index 6d2a08205111..dc442fb791b0 100644
--- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
@@ -177,8 +177,7 @@ static unsigned int ipv6_confirm(unsigned int hooknum,
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 --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
index 0be790d250f9..8814b95b2326 100644
--- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
@@ -168,8 +168,7 @@ icmpv6_error_message(struct sk_buff *skb,
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 --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index 45b3cda86a21..6f8684b5617e 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -164,8 +164,7 @@ static int tcf_pedit(struct sk_buff *skb, struct tc_action *a,
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 --git a/net/sctp/debug.c b/net/sctp/debug.c
index e8c0f7435d7f..80f70aa53386 100644
--- a/net/sctp/debug.c
+++ b/net/sctp/debug.c
@@ -77,8 +77,6 @@ static const char *sctp_cid_tbl[SCTP_NUM_BASE_CHUNK_TYPES] = {
/* 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 @@ static const char *sctp_primitive_tbl[SCTP_NUM_PRIMITIVE_TYPES] = {
/* 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 @@ static const char *sctp_other_tbl[] = {
/* Lookup "other" debug name. */
const char *sctp_oname(const sctp_subtype_t id)
{
- if (id.other < 0)
- return "illegal 'other' event";
if (id.other <= SCTP_EVENT_OTHER_MAX)
return sctp_other_tbl[id.other];
return "unknown 'other' event";
@@ -184,8 +178,6 @@ static const char *sctp_timer_tbl[] = {
/* Lookup timer debug name. */
const char *sctp_tname(const sctp_subtype_t id)
{
- if (id.timeout < 0)
- return "illegal 'timer' event";
if (id.timeout <= SCTP_EVENT_TIMEOUT_MAX)
return sctp_timer_tbl[id.timeout];
return "unknown_timer";
diff --git a/net/sctp/sm_statetable.c b/net/sctp/sm_statetable.c
index 523071c7902f..70a91ece3c49 100644
--- a/net/sctp/sm_statetable.c
+++ b/net/sctp/sm_statetable.c
@@ -960,7 +960,7 @@ static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(sctp_cid_t cid,
if (state > SCTP_STATE_MAX)
return &bug;
- if (cid >= 0 && cid <= SCTP_CID_BASE_MAX)
+ if (cid <= SCTP_CID_BASE_MAX)
return &chunk_event_table[cid][state];
if (sctp_prsctp_enable) {
diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c
index 7a19e0ede289..849cc06bd914 100644
--- a/net/wanrouter/wanmain.c
+++ b/net/wanrouter/wanmain.c
@@ -454,7 +454,7 @@ static int wanrouter_device_setup(struct wan_device *wandev,
}
if (conf->data_size && conf->data) {
- if (conf->data_size > 128000 || conf->data_size < 0) {
+ if (conf->data_size > 128000) {
printk(KERN_INFO
"%s: ERROR, Invalid firmware data size %i !\n",
wandev->name, conf->data_size);