]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
coverity: remove always false comparison
authorVincent Bernat <bernat@luffy.cx>
Fri, 22 Nov 2013 22:34:06 +0000 (23:34 +0100)
committerVincent Bernat <bernat@luffy.cx>
Fri, 22 Nov 2013 22:34:06 +0000 (23:34 +0100)
Also ensure that we use unsigned integers since we are reading unsigned
chars.

src/daemon/lldp.c

index f6730559f717b3bf46a9ac1d570bbca07b67899c..658430902f2b237925d32a5cf7e1f66c75a8bdf4 100644 (file)
@@ -805,8 +805,8 @@ lldp_decode(struct lldpd *cfg, char *frame, int s,
                                hardware->h_rx_unrecognized_cnt++;
 #else
                                u_int32_t policy;
-                               int loctype;
-                               int power;
+                               unsigned loctype;
+                               unsigned power;
 
                                switch (tlv_subtype) {
                                case LLDP_TLV_MED_CAP:
@@ -920,8 +920,7 @@ lldp_decode(struct lldpd *cfg, char *frame, int s,
                                                port->p_med_power.devicetype =
                                                    LLDP_MED_POW_TYPE_RESERVED;
                                        }
-                                       if (((power & 0x0F) < 0) ||
-                                           ((power & 0x0F) > LLDP_MED_POW_PRIO_LOW))
+                                       if ((power & 0x0F) > LLDP_MED_POW_PRIO_LOW)
                                                port->p_med_power.priority =
                                                    LLDP_MED_POW_PRIO_UNKNOWN;
                                        else