Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1341649 > unrolled thread

[PATCH] 6lowpan: fix error checking code

Started byAndrzej Hajda <a.hajda@samsung.com>
First post2016-02-24 09:40 +0100
Last post2016-02-24 16:20 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] 6lowpan: fix error checking code Andrzej Hajda <a.hajda@samsung.com> - 2016-02-24 09:40 +0100
    Re: [PATCH] 6lowpan: fix error checking code Alexander Aring <aar@pengutronix.de> - 2016-02-24 11:50 +0100
    Re: [PATCH] 6lowpan: fix error checking code Marcel Holtmann <marcel@holtmann.org> - 2016-02-24 16:20 +0100

#1341649 — [PATCH] 6lowpan: fix error checking code

FromAndrzej Hajda <a.hajda@samsung.com>
Date2016-02-24 09:40 +0100
Subject[PATCH] 6lowpan: fix error checking code
Message-ID<r5D9g-1Oq-21@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1341820

FromAlexander Aring <aar@pengutronix.de>
Date2016-02-24 11:50 +0100
Message-ID<r5Fb4-3dH-41@gated-at.bofh.it>
In reply to#1341649
Hi,

Am 02/24/2016 um 09:32 AM schrieb Andrzej Hajda:
> 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>

Marcel, can you please apply this patch on bluetooth-next?
Thanks.

- Alex

[toc] | [prev] | [next] | [standalone]


#1342125

FromMarcel Holtmann <marcel@holtmann.org>
Date2016-02-24 16:20 +0100
Message-ID<r5Joo-6qY-59@gated-at.bofh.it>
In reply to#1341649
Hi Alex,

> 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(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web