From patchwork Wed Feb 24 08:32:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 8402821 Return-Path: X-Original-To: patchwork-linux-wpan@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 46F169F52D for ; Wed, 24 Feb 2016 08:32:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 793332034A for ; Wed, 24 Feb 2016 08:32:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9872D202EC for ; Wed, 24 Feb 2016 08:32:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755323AbcBXIc2 (ORCPT ); Wed, 24 Feb 2016 03:32:28 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:17415 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752147AbcBXIc1 (ORCPT ); Wed, 24 Feb 2016 03:32:27 -0500 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O31006B5ME01D40@mailout1.w1.samsung.com>; Wed, 24 Feb 2016 08:32:24 +0000 (GMT) X-AuditID: cbfec7f4-f79026d00000418a-a4-56cd6a98df17 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id FA.50.16778.89A6DC65; Wed, 24 Feb 2016 08:32:24 +0000 (GMT) Received: from AMDC1061.digital.local ([106.116.147.88]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O3100I8OMDZOO00@eusync4.samsung.com>; Wed, 24 Feb 2016 08:32:24 +0000 (GMT) From: Andrzej Hajda To: Alexander Aring , Jukka Rissanen , linux-wpan@vger.kernel.org Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] 6lowpan: fix error checking code Date: Wed, 24 Feb 2016 09:32:13 +0100 Message-id: <1456302733-7053-1-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrJJMWRmVeSWpSXmKPExsVy+t/xa7ozss6GGWzazWVxa905Vou5Z0st Ns5Yz2rx/NNWdos51/qYLS7vmsNmcWfyMhaLtUfusjtweMw7GejR/9fAo2/LKkaPz5vkAlii uGxSUnMyy1KL9O0SuDJ2zD/EVHCYreL6qZfMDYzbWLsYOTkkBEwkOra1skPYYhIX7q1nA7GF BJYySizZpNjFyAVkNzFJfPz9mAkkwSagKfF3802wIhGBcol1m04ygxQxC5xnlGg5dJkRJCEs YCixYPJ2MJtFQFXi5sGvYNt4BZwk/i/ZywyxTU7i5LHJrBMYuRcwMqxiFE0tTS4oTkrPNdQr TswtLs1L10vOz93ECAmQLzsYFx+zOsQowMGoxMP7YMOZMCHWxLLiytxDjBIczEoivHZpZ8OE eFMSK6tSi/Lji0pzUosPMUpzsCiJ887d9T5ESCA9sSQ1OzW1ILUIJsvEwSnVwBhqEujlnLDl 5ebCiO9uCZemP1KYvvvAnKLEBJbVBvusl16vO1T/e5XVB/kf213crc9WFrirbZ/F9P/G7DW2 Bfx3Gx9r/eRk7lGqftUw18yI+Xmq5L39Mu9+PpE94hc+NUDBpPHH9VNrdjBl2jvXfLhQ27rR OS73oofR1XdTHzFovHuSrc53aIcSS3FGoqEWc1FxIgDJX0BLDAIAAA== Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Alexander Aring --- 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 */