From patchwork Mon Sep 21 13:33:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 7230751 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 001A2BEEC1 for ; Mon, 21 Sep 2015 13:46:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2E05720561 for ; Mon, 21 Sep 2015 13:46:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C562C20558 for ; Mon, 21 Sep 2015 13:45:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756163AbbIUNn6 (ORCPT ); Mon, 21 Sep 2015 09:43:58 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:43643 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932408AbbIUNgY (ORCPT ); Mon, 21 Sep 2015 09:36:24 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NV100C1W4GJ8J40@mailout3.w1.samsung.com>; Mon, 21 Sep 2015 14:36:19 +0100 (BST) X-AuditID: cbfec7f4-f79c56d0000012ee-e3-560007d320a7 Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id C9.67.04846.3D700065; Mon, 21 Sep 2015 14:36:19 +0100 (BST) Received: from AMDC1061.digital.local ([106.116.147.88]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NV100LNT4DTKI10@eusync3.samsung.com>; Mon, 21 Sep 2015 14:36:19 +0100 (BST) From: Andrzej Hajda To: linux-kernel@vger.kernel.org Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , Jussi Kivilinna , Kalle Valo , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 23/38] rndis_wlan: fix checking for default value Date: Mon, 21 Sep 2015 15:33:55 +0200 Message-id: <1442842450-29769-24-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1442842450-29769-1-git-send-email-a.hajda@samsung.com> References: <1442842450-29769-1-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprMLMWRmVeSWpSXmKPExsVy+t/xq7qX2RnCDNZvlLK4te4cq8XGGetZ Lc6c7mO0WLRyIZvF5V1z2CzerLjDbrH2yF12i2MLxBw4PC739TJ5HP66kMWjb8sqRo/Pm+QC WKK4bFJSczLLUov07RK4Mh58+cRU8I29Yt9/rQbGe2xdjJwcEgImEh961zNB2GISF+6tB4pz cQgJLGWU2NVwgx3CaWKSONDSxghSxSagKfF3802wbhEBBYnNvc9YQYqYBaYzSaztPgs2SljA UeLHnA9gDSwCqhJ3Z5xgB7F5BVwkXt6cywyxTk7i5LHJrCA2J1D8wMEvLCC2kICzxIElR5gm MPIuYGRYxSiaWppcUJyUnmuoV5yYW1yal66XnJ+7iRESVF92MC4+ZnWIUYCDUYmH10Hgf6gQ a2JZcWXuIUYJDmYlEV6dWUAh3pTEyqrUovz4otKc1OJDjNIcLErivHN3vQ8REkhPLEnNTk0t SC2CyTJxcEo1MHpsVvjSapIfzdX4283Qb2XKS7nXUouf3ln0yJUj5MHq+hKhWl6xfe958rU1 nKd/S7j/ahNDR+n1z0b2WyVOfN/rqNfWqx3ZNSuzXaDrvYrpznuaHx43MDGb7inZ6P7nTU5M 7b/eI7msTc2aP8vdTHQmnS4ULhK8uPBzwIozmsV/niszTDl6UomlOCPRUIu5qDgRANOHQZAm AgAA Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@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 Thresholds uses -1 to indicate that default value should be used. Since thresholds are unsigned sign checking makes no sense. The problem has been detected using proposed semantic patch scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2038576 Signed-off-by: Andrzej Hajda --- drivers/net/wireless/rndis_wlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index 71a825c..a13d1f2 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c @@ -1236,7 +1236,7 @@ static int set_rts_threshold(struct usbnet *usbdev, u32 rts_threshold) netdev_dbg(usbdev->net, "%s(): %i\n", __func__, rts_threshold); - if (rts_threshold < 0 || rts_threshold > 2347) + if (rts_threshold == -1 || rts_threshold > 2347) rts_threshold = 2347; tmp = cpu_to_le32(rts_threshold);