From patchwork Wed Oct 10 18:13:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Franky Lin X-Patchwork-Id: 1575211 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id D855D3FE36 for ; Wed, 10 Oct 2012 18:13:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932219Ab2JJSNc (ORCPT ); Wed, 10 Oct 2012 14:13:32 -0400 Received: from mms1.broadcom.com ([216.31.210.17]:3430 "EHLO mms1.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756948Ab2JJSNZ (ORCPT ); Wed, 10 Oct 2012 14:13:25 -0400 Received: from [10.9.200.131] by mms1.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.5)); Wed, 10 Oct 2012 11:12:12 -0700 X-Server-Uuid: 06151B78-6688-425E-9DE2-57CB27892261 Received: from mail-irva-13.broadcom.com (10.11.16.103) by IRVEXCHHUB01.corp.ad.broadcom.com (10.9.200.131) with Microsoft SMTP Server id 8.2.247.2; Wed, 10 Oct 2012 11:13:15 -0700 Received: from mail-sj1-12.sj.broadcom.com (mail-sj1-12.sj.broadcom.com [10.17.16.106]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 752AD40FED; Wed, 10 Oct 2012 11:13:15 -0700 (PDT) Received: from lc-sj1-3560.broadcom.com (lc-sj1-3560.sj.broadcom.com [10.17.194.250]) by mail-sj1-12.sj.broadcom.com (Postfix) with ESMTP id AA505207D1; Wed, 10 Oct 2012 11:13:13 -0700 (PDT) Received: by lc-sj1-3560.broadcom.com (Postfix, from userid 25250) id B5270158A5B9; Wed, 10 Oct 2012 11:13:12 -0700 (PDT) From: "Franky Lin" To: linville@tuxdriver.com cc: linux-wireless@vger.kernel.org, "Arend van Spriel" Subject: [PATCH 6/7] brcmfmac: remove 'always false' condition from brcmf_c_mkiovar_bsscfg Date: Wed, 10 Oct 2012 11:13:11 -0700 Message-ID: <1349892792-4792-7-git-send-email-frankyl@broadcom.com> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1349892792-4792-1-git-send-email-frankyl@broadcom.com> References: <1349892792-4792-1-git-send-email-frankyl@broadcom.com> MIME-Version: 1.0 X-WSS-ID: 7C6B65F64144434071-01-01 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Arend van Spriel The parameter buflen is unsigned so the condition buflen < 0 is always false. The patch fixes the if statement checking the buffer length. Reported-by: Dan Carpenter Reviewed-by: Pieter-Paul Giesberts Reviewed-by: Hante Meuleman Signed-off-by: Arend van Spriel Signed-off-by: Franky Lin --- .../net/wireless/brcm80211/brcmfmac/dhd_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c index 15c5db5..a081e68 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c @@ -106,7 +106,7 @@ brcmf_c_mkiovar_bsscfg(char *name, char *data, uint datalen, namelen = (u32) strlen(name) + 1; /* lengh of iovar name + null */ iolen = prefixlen + namelen + sizeof(bssidx_le) + datalen; - if (buflen < 0 || iolen > (u32)buflen) { + if ((u32)buflen < iolen) { brcmf_dbg(ERROR, "buffer is too short\n"); return 0; }