6lowpan: fix error checking code
authorAndrzej Hajda <a.hajda@samsung.com>
Wed, 24 Feb 2016 08:32:13 +0000 (09:32 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 24 Feb 2016 15:16:04 +0000 (16:16 +0100)
Bool variable 'fail' is always non-negative, it indicates an error if it
is true.

The problem has been detected using coccinelle script
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Acked-by: Alexander Aring <aar@pengutronix.de>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/6lowpan/iphc.c

index 8dd8388..06287ac 100644 (file)
@@ -482,7 +482,7 @@ static int lowpan_uncompress_multicast_ctx_daddr(struct sk_buff *skb,
        ipaddr->s6_addr[0] = 0xFF;
        fail = lowpan_fetch_skb(skb, &ipaddr->s6_addr[1], 2);
        fail |= lowpan_fetch_skb(skb, &ipaddr->s6_addr[12], 4);
-       if (fail < 0)
+       if (fail)
                return -EIO;
 
        /* take prefix_len and network prefix from the context */