All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 6lowpan: fix error checking code
@ 2016-02-24  8:32 Andrzej Hajda
  2016-02-24 10:40 ` Alexander Aring
  2016-02-24 15:16 ` Marcel Holtmann
  0 siblings, 2 replies; 3+ messages in thread
From: Andrzej Hajda @ 2016-02-24  8:32 UTC (permalink / raw)
  To: Alexander Aring, Jukka Rissanen, linux-wpan
  Cc: Andrzej Hajda, Bartlomiej Zolnierkiewicz, Marek Szyprowski,
	linux-bluetooth, linux-kernel

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>
---
 net/6lowpan/iphc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/6lowpan/iphc.c b/net/6lowpan/iphc.c
index d2a565c..0fe954f 100644
--- a/net/6lowpan/iphc.c
+++ b/net/6lowpan/iphc.c
@@ -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 */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-02-24 15:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-24  8:32 [PATCH] 6lowpan: fix error checking code Andrzej Hajda
2016-02-24 10:40 ` Alexander Aring
2016-02-24 15:16 ` Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.