X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fnetlink.c;h=b15768e719d5c7ea847848ea63db4142e703c45c;hb=c57f2a191b63ce73fc432befebe9fa3af97c8eb5;hp=8f45ea2e79334927b3b29942a3f33296bb9f2a6e;hpb=b72d521340383b6418fa6a75faca3bc45f06b14a;p=collectd.git diff --git a/src/netlink.c b/src/netlink.c index 8f45ea2e..b15768e7 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -246,7 +246,7 @@ static int link_filter (const struct sockaddr_nl __attribute__((unused)) *sa, /* Update the `iflist'. It's used to know which interfaces exist and query * them later for qdiscs and classes. */ - if (msg->ifi_index >= iflist_len) + if ((msg->ifi_index >= 0) && ((size_t) msg->ifi_index >= iflist_len)) { char **temp; @@ -359,7 +359,8 @@ static int qos_filter (const struct sockaddr_nl __attribute__((unused)) *sa, return (0); } - if (msg->tcm_ifindex >= iflist_len) + if ((msg->tcm_ifindex >= 0) + && ((size_t) msg->tcm_ifindex >= iflist_len)) { ERROR ("netlink plugin: qos_filter: msg->tcm_ifindex = %i " ">= iflist_len = %zu", @@ -580,9 +581,9 @@ static int ir_read (void) /* `link_filter' will update `iflist' which is used here to iterate over all * interfaces. */ - for (ifindex = 0; ifindex < iflist_len; ifindex++) + for (ifindex = 0; (size_t) ifindex < iflist_len; ifindex++) { - int type_index; + size_t type_index; if (iflist[ifindex] == NULL) continue;