From: Vincent Bernat Date: Fri, 22 Nov 2013 22:34:06 +0000 (+0100) Subject: coverity: remove always false comparison X-Git-Tag: 0.7.8~73 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cdece23a6df4362b360fbfd9d1c0cf9b9e6c548d;p=thirdparty%2Flldpd.git coverity: remove always false comparison Also ensure that we use unsigned integers since we are reading unsigned chars. --- diff --git a/src/daemon/lldp.c b/src/daemon/lldp.c index f6730559..65843090 100644 --- a/src/daemon/lldp.c +++ b/src/daemon/lldp.c @@ -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