From: paco Date: Mon, 18 Jun 2018 17:07:24 +0000 (+0200) Subject: babeld, eigrpd, ospfd: unsigned negative check X-Git-Tag: frr-6.1-dev~309^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=d11c6941dc5e3663891e61a4e24f94b4d0e6bd68;p=matthieu%2Ffrr.git babeld, eigrpd, ospfd: unsigned negative check After Cppcheck 1.72 feedback Signed-off-by: F. Aragon --- diff --git a/babeld/message.c b/babeld/message.c index 1ff4867908..95b4e87cc7 100644 --- a/babeld/message.c +++ b/babeld/message.c @@ -662,7 +662,7 @@ static int check_bucket(struct interface *ifp) { babel_interface_nfo *babel_ifp = babel_get_if_nfo(ifp); - if(babel_ifp->bucket <= 0) { + if(babel_ifp->bucket == 0) { int seconds = babel_now.tv_sec - babel_ifp->bucket_time; if(seconds > 0) { babel_ifp->bucket = MIN(BUCKET_TOKENS_MAX, diff --git a/babeld/neighbour.c b/babeld/neighbour.c index 48a32c4a9c..3db121fd26 100644 --- a/babeld/neighbour.c +++ b/babeld/neighbour.c @@ -120,7 +120,7 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval) int rc = 0; if(hello < 0) { - if(neigh->hello_interval <= 0) + if(neigh->hello_interval == 0) return rc; missed_hellos = ((int)timeval_minus_msec(&babel_now, &neigh->hello_time) - diff --git a/eigrpd/eigrp_snmp.c b/eigrpd/eigrp_snmp.c index 7dd95b7bc6..1a6dee681f 100644 --- a/eigrpd/eigrp_snmp.c +++ b/eigrpd/eigrp_snmp.c @@ -573,7 +573,7 @@ static struct eigrp_neighbor *eigrpNbrLookup(struct variable *v, oid *name, first = 0; len = *length - v->namelen; - if (len <= 0) + if (len == 0) first = 1; if (len > IN_ADDR_SIZE) diff --git a/ospfd/ospf_snmp.c b/ospfd/ospf_snmp.c index 6825be83ac..c90db031dc 100644 --- a/ospfd/ospf_snmp.c +++ b/ospfd/ospf_snmp.c @@ -1626,7 +1626,7 @@ static struct ospf_interface *ospfIfLookup(struct variable *v, oid *name, len = *length - v->namelen; if (len >= IN_ADDR_SIZE) len = IN_ADDR_SIZE; - if (len <= 0) + if (len == 0) ifaddr_next = 1; oid2in_addr(name + v->namelen, len, ifaddr); @@ -1990,7 +1990,7 @@ ospfVirtIfLookup(struct variable *v, oid *name, size_t *length, first = 0; len = *length - v->namelen; - if (len <= 0) + if (len == 0) first = 1; if (len > IN_ADDR_SIZE) len = IN_ADDR_SIZE; @@ -2176,7 +2176,7 @@ static struct ospf_neighbor *ospfNbrLookup(struct variable *v, oid *name, first = 0; len = *length - v->namelen; - if (len <= 0) + if (len == 0) first = 1; if (len > IN_ADDR_SIZE)