Skip to content

Commit

Permalink
6lowpan: fix error checking code
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andrzej Hajda authored and Marcel Holtmann committed Feb 24, 2016
1 parent 8790404 commit 4c23d87
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/6lowpan/iphc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 4c23d87

Please sign in to comment.