From cdece23a6df4362b360fbfd9d1c0cf9b9e6c548d Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Fri, 22 Nov 2013 23:34:06 +0100 Subject: [PATCH] coverity: remove always false comparison Also ensure that we use unsigned integers since we are reading unsigned chars. --- src/daemon/lldp.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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 -- 2.39.5