From patchwork Mon Sep 21 13:33:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 7230931 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 8C59DBEEC1 for ; Mon, 21 Sep 2015 13:50:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B34D020761 for ; Mon, 21 Sep 2015 13:50:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D180620764 for ; Mon, 21 Sep 2015 13:50:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932423AbbIUNth (ORCPT ); Mon, 21 Sep 2015 09:49:37 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:34733 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932291AbbIUNgT (ORCPT ); Mon, 21 Sep 2015 09:36:19 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NV100KOX4GIWT30@mailout1.w1.samsung.com>; Mon, 21 Sep 2015 14:36:18 +0100 (BST) X-AuditID: cbfec7f5-f794b6d000001495-4a-560007d208bc Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 53.67.05269.2D700065; Mon, 21 Sep 2015 14:36:18 +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:18 +0100 (BST) From: Andrzej Hajda To: linux-kernel@vger.kernel.org Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , Brett Rudley , Arend van Spriel , "Franky (Zhenhui) Lin" , Hante Meuleman , Kalle Valo , linux-wireless@vger.kernel.org, brcm80211-dev-list@broadcom.com, netdev@vger.kernel.org Subject: [PATCH 20/38] net: brcm80211: fix range check Date: Mon, 21 Sep 2015 15:33:52 +0200 Message-id: <1442842450-29769-21-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+NgFlrGLMWRmVeSWpSXmKPExsVy+t/xq7qX2BnCDDov8FrcWneO1aL5TT+z xcYZ61kt1jVsZ7OYfukqm8XOj6uYLRatXMhmcXnXHDaLNyvusFusPXKX3WLCrr2sFscWiDnw eMy6f5bN43JfL5NH35ZVjB6fN8kFsERx2aSk5mSWpRbp2yVwZTQ//MxUcISjoulEB1sD4yr2 LkZODgkBE4lNjWdZIWwxiQv31rN1MXJxCAksZZSY3PGXGcJpYpJYv+Y0WAebgKbE38032UBs EQEFic29z8C6mQW2M0vM/aHaxcjBISxgJrHoNiNImEVAVeLW3T1grbwCLhLPVk9ihFgmJ3Hy 2GSwVk6g+IGDX1hAbCEBZ4kDS44wTWDkXcDIsIpRNLU0uaA4KT3XSK84Mbe4NC9dLzk/dxMj JPS+7mBceszqEKMAB6MSD6+jwP9QIdbEsuLK3EOMEhzMSiK8OrOAQrwpiZVVqUX58UWlOanF hxilOViUxHln7nofIiSQnliSmp2aWpBaBJNl4uCUamB0uXjO6c4tH4H035s1vZ4aBJQtZexy q2qO4OVKKF7xqkv4m3ncK8ddy67FCcxnmxGWpLt//YKe3F2dXoGi75wWq7xUV9Z6scd1zfvA R0qB675apffxLp3G2b0xwbTsrtHxaR5rXE/8nfT9zfPWFYocFlfvvLk7Vazrup216/uWvHa5 jyoVGVFKLMUZiYZazEXFiQC8Ld1fOQIAAA== 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 Unsigned minus constant is still unsigned so checking its sign 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/brcm80211/brcmsmac/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c index 9728be0..218cbc8 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c @@ -4585,7 +4585,7 @@ static int brcms_b_attach(struct brcms_c_info *wlc, struct bcma_device *core, wlc_hw->machwcap_backup = wlc_hw->machwcap; /* init tx fifo size */ - WARN_ON((wlc_hw->corerev - XMTFIFOTBL_STARTREV) < 0 || + WARN_ON(wlc_hw->corerev < XMTFIFOTBL_STARTREV || (wlc_hw->corerev - XMTFIFOTBL_STARTREV) > ARRAY_SIZE(xmtfifo_sz)); wlc_hw->xmtfifo_sz =