Commit 75202e76 authored by Bill Nottingham's avatar Bill Nottingham Committed by David S. Miller

[NET]: Fix comparisons of unsigned < 0.

Recent gcc versions emit warnings when unsigned variables are
compared < 0 or >= 0.
Signed-off-by: default avatarBill Nottingham <notting@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 60468d5b
...@@ -736,8 +736,7 @@ static int vlan_ioctl_handler(void __user *arg) ...@@ -736,8 +736,7 @@ static int vlan_ioctl_handler(void __user *arg)
case SET_VLAN_NAME_TYPE_CMD: case SET_VLAN_NAME_TYPE_CMD:
if (!capable(CAP_NET_ADMIN)) if (!capable(CAP_NET_ADMIN))
return -EPERM; return -EPERM;
if ((args.u.name_type >= 0) && if (args.u.name_type < VLAN_NAME_TYPE_HIGHEST) {
(args.u.name_type < VLAN_NAME_TYPE_HIGHEST)) {
vlan_name_type = args.u.name_type; vlan_name_type = args.u.name_type;
err = 0; err = 0;
} else { } else {
......
...@@ -128,7 +128,7 @@ static ssize_t dccpprobe_read(struct file *file, char __user *buf, ...@@ -128,7 +128,7 @@ static ssize_t dccpprobe_read(struct file *file, char __user *buf,
int error = 0, cnt = 0; int error = 0, cnt = 0;
unsigned char *tbuf; unsigned char *tbuf;
if (!buf || len < 0) if (!buf)
return -EINVAL; return -EINVAL;
if (len == 0) if (len == 0)
......
...@@ -177,8 +177,7 @@ static unsigned int ipv6_confirm(unsigned int hooknum, ...@@ -177,8 +177,7 @@ static unsigned int ipv6_confirm(unsigned int hooknum,
protoff = nf_ct_ipv6_skip_exthdr(*pskb, extoff, &pnum, protoff = nf_ct_ipv6_skip_exthdr(*pskb, extoff, &pnum,
(*pskb)->len - extoff); (*pskb)->len - extoff);
if (protoff < 0 || protoff > (*pskb)->len || if (protoff > (*pskb)->len || pnum == NEXTHDR_FRAGMENT) {
pnum == NEXTHDR_FRAGMENT) {
DEBUGP("proto header not found\n"); DEBUGP("proto header not found\n");
return NF_ACCEPT; return NF_ACCEPT;
} }
......
...@@ -168,8 +168,7 @@ icmpv6_error_message(struct sk_buff *skb, ...@@ -168,8 +168,7 @@ icmpv6_error_message(struct sk_buff *skb,
skb->len - inip6off skb->len - inip6off
- sizeof(struct ipv6hdr)); - sizeof(struct ipv6hdr));
if ((inprotoff < 0) || (inprotoff > skb->len) || if ((inprotoff > skb->len) || (inprotonum == NEXTHDR_FRAGMENT)) {
(inprotonum == NEXTHDR_FRAGMENT)) {
DEBUGP("icmpv6_error: Can't get protocol header in ICMPv6 payload.\n"); DEBUGP("icmpv6_error: Can't get protocol header in ICMPv6 payload.\n");
return -NF_ACCEPT; return -NF_ACCEPT;
} }
......
...@@ -164,8 +164,7 @@ static int tcf_pedit(struct sk_buff *skb, struct tc_action *a, ...@@ -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"); printk("offset must be on 32 bit boundaries\n");
goto bad; goto bad;
} }
if (skb->len < 0 || if (offset > 0 && offset > skb->len) {
(offset > 0 && offset > skb->len)) {
printk("offset %d cant exceed pkt length %d\n", printk("offset %d cant exceed pkt length %d\n",
offset, skb->len); offset, skb->len);
goto bad; goto bad;
......
...@@ -77,8 +77,6 @@ static const char *sctp_cid_tbl[SCTP_NUM_BASE_CHUNK_TYPES] = { ...@@ -77,8 +77,6 @@ static const char *sctp_cid_tbl[SCTP_NUM_BASE_CHUNK_TYPES] = {
/* Lookup "chunk type" debug name. */ /* Lookup "chunk type" debug name. */
const char *sctp_cname(const sctp_subtype_t cid) const char *sctp_cname(const sctp_subtype_t cid)
{ {
if (cid.chunk < 0)
return "illegal chunk id";
if (cid.chunk <= SCTP_CID_BASE_MAX) if (cid.chunk <= SCTP_CID_BASE_MAX)
return sctp_cid_tbl[cid.chunk]; return sctp_cid_tbl[cid.chunk];
...@@ -146,8 +144,6 @@ static const char *sctp_primitive_tbl[SCTP_NUM_PRIMITIVE_TYPES] = { ...@@ -146,8 +144,6 @@ static const char *sctp_primitive_tbl[SCTP_NUM_PRIMITIVE_TYPES] = {
/* Lookup primitive debug name. */ /* Lookup primitive debug name. */
const char *sctp_pname(const sctp_subtype_t id) const char *sctp_pname(const sctp_subtype_t id)
{ {
if (id.primitive < 0)
return "illegal primitive";
if (id.primitive <= SCTP_EVENT_PRIMITIVE_MAX) if (id.primitive <= SCTP_EVENT_PRIMITIVE_MAX)
return sctp_primitive_tbl[id.primitive]; return sctp_primitive_tbl[id.primitive];
return "unknown_primitive"; return "unknown_primitive";
...@@ -161,8 +157,6 @@ static const char *sctp_other_tbl[] = { ...@@ -161,8 +157,6 @@ static const char *sctp_other_tbl[] = {
/* Lookup "other" debug name. */ /* Lookup "other" debug name. */
const char *sctp_oname(const sctp_subtype_t id) const char *sctp_oname(const sctp_subtype_t id)
{ {
if (id.other < 0)
return "illegal 'other' event";
if (id.other <= SCTP_EVENT_OTHER_MAX) if (id.other <= SCTP_EVENT_OTHER_MAX)
return sctp_other_tbl[id.other]; return sctp_other_tbl[id.other];
return "unknown 'other' event"; return "unknown 'other' event";
...@@ -184,8 +178,6 @@ static const char *sctp_timer_tbl[] = { ...@@ -184,8 +178,6 @@ static const char *sctp_timer_tbl[] = {
/* Lookup timer debug name. */ /* Lookup timer debug name. */
const char *sctp_tname(const sctp_subtype_t id) const char *sctp_tname(const sctp_subtype_t id)
{ {
if (id.timeout < 0)
return "illegal 'timer' event";
if (id.timeout <= SCTP_EVENT_TIMEOUT_MAX) if (id.timeout <= SCTP_EVENT_TIMEOUT_MAX)
return sctp_timer_tbl[id.timeout]; return sctp_timer_tbl[id.timeout];
return "unknown_timer"; return "unknown_timer";
......
...@@ -960,7 +960,7 @@ static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(sctp_cid_t cid, ...@@ -960,7 +960,7 @@ static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(sctp_cid_t cid,
if (state > SCTP_STATE_MAX) if (state > SCTP_STATE_MAX)
return &bug; return &bug;
if (cid >= 0 && cid <= SCTP_CID_BASE_MAX) if (cid <= SCTP_CID_BASE_MAX)
return &chunk_event_table[cid][state]; return &chunk_event_table[cid][state];
if (sctp_prsctp_enable) { if (sctp_prsctp_enable) {
......
...@@ -454,7 +454,7 @@ static int wanrouter_device_setup(struct wan_device *wandev, ...@@ -454,7 +454,7 @@ static int wanrouter_device_setup(struct wan_device *wandev,
} }
if (conf->data_size && conf->data) { if (conf->data_size && conf->data) {
if (conf->data_size > 128000 || conf->data_size < 0) { if (conf->data_size > 128000) {
printk(KERN_INFO printk(KERN_INFO
"%s: ERROR, Invalid firmware data size %i !\n", "%s: ERROR, Invalid firmware data size %i !\n",
wandev->name, conf->data_size); wandev->name, conf->data_size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment