From patchwork Mon Dec 11 07:38:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wright Feng X-Patchwork-Id: 10104357 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3A03860235 for ; Mon, 11 Dec 2017 07:38:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 115A2292CC for ; Mon, 11 Dec 2017 07:38:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0420229450; Mon, 11 Dec 2017 07:38:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76195292CC for ; Mon, 11 Dec 2017 07:38:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751760AbdLKHii (ORCPT ); Mon, 11 Dec 2017 02:38:38 -0500 Received: from mail-bn3nam01on0125.outbound.protection.outlook.com ([104.47.33.125]:18656 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751307AbdLKHig (ORCPT ); Mon, 11 Dec 2017 02:38:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cycorp.onmicrosoft.com; s=selector1-cypress-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=QPgedXoiDZurUEp/udXwG9LmJvybqQtewa6+qsCT518=; b=rrrEXOGm+2dY+nNzR3/EAgDSDt0Zd86YJPSbt4Xqt/CoOK7e/JHeH/7SkzNoATE3vjES8IZJegmIPz9z8nO0FSWmciZQmw5WK4HzMfHM4Mbmg2nRXFWlXyssRPQHoq1kUMMfBxgPXnsBG+oMooOH3XgjPqmTM+HV4+Vl6YHmG1Y= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Wright.Feng@cypress.com; Received: from localhost (61.222.14.99) by DM5PR0601MB3589.namprd06.prod.outlook.com (2603:10b6:4:7c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.302.9; Mon, 11 Dec 2017 07:38:34 +0000 From: Wright Feng To: arend.vanspriel@broadcom.com, franky.lin@broadcom.com, hante.meuleman@broadcom.com, kvalo@codeaurora.org, chi-hsien.lin@cypress.com Cc: wright.feng@cypress.com, linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com Subject: [PATCH] brcmfmac: enlarge buffer size of caps to 512 bytes Date: Mon, 11 Dec 2017 15:38:21 +0800 Message-Id: <1512977901-12726-1-git-send-email-wright.feng@cypress.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [61.222.14.99] X-ClientProxiedBy: TY1PR01CA0109.jpnprd01.prod.outlook.com (2603:1096:401:d::27) To DM5PR0601MB3589.namprd06.prod.outlook.com (2603:10b6:4:7c::11) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 977db0bd-0a83-4321-8bb8-08d5406a2f41 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603307); SRVR:DM5PR0601MB3589; X-Microsoft-Exchange-Diagnostics: 1; DM5PR0601MB3589; 3:sL9aSC7YUVAxQ8l9jBCZDm7iwKXR/NY0hm7AApF2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V85sPvKP8f3bZnqoyai6HG/fuRly8S0YU0C1/s1khmixiRA0sNViK/n8N//a03fdO9O0SXvlOTFekiw6izIUEsNCW81rx/hM7KWENkmqPGHFM41AtskzzrBtY7NVv2Sk46K3bQPhPwDO0IMIape0ODFshXv7v+71umIfBluimSl/E6gZqeBDCos0riKihrxR85p2tXjQoRx2VrfKa/Acl9M37kMCp8RirtGlJ8N+7wKeEMuwpn1DWZjb+TqLpe39NrMAAeAwLTQDxUd2K2vBWEfkFPcdkcA2SIbTWdTDfbMmD6; 4:xBRtRrCqOW9A8inRuYhM2d65trQC/JyrQkAtbTLdlTY2Xjcvf1AA498a7MEBatRo+hVfra5oXkfyLO9Hk20l6i8UuzbnIsuvMO9ayuYU7DnHbIcGJjLkzAxZzP0BrhbtTDzaEXtBsP2a1FGAe9FY+LY/Zy/vdujV5vNN/MYwF7TWb7xulg+e6FzKPtCTKxybKI6gVaUOSJybfClY926hjdcaHeDjjIxeBdB/TRLL8yCFDHRYVRqS1EEH4rqVuxAdlwV0red6JoGq3+f0Wp/fD+Z0F6kLSR1p9ipGqbHjKJzjECo5YSKzNx3J93ofMLLL X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(258095267146985); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231022)(10201501046)(3002001)(6055026)(6041248)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123562025)(20161123560025)(20161123564025)(6072148)(201708071742011); SRVR:DM5PR0601MB3589; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DM5PR0601MB3589; X-Forefront-PRVS: 0518EEFB48 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(366004)(346002)(39860400002)(376002)(189003)(199004)(53936002)(8676002)(48376002)(81156014)(81166006)(16526018)(16586007)(316002)(305945005)(7736002)(50466002)(72206003)(478600001)(33646002)(8936002)(25786009)(86362001)(47776003)(105586002)(66066001)(68736007)(76506005)(50226002)(5660300001)(106356001)(6666003)(6636002)(97736004)(4326008)(36756003)(2906002)(51416003)(3846002)(52116002)(6486002)(6496006)(6116002)(161623001)(147533002); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR0601MB3589; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cypress.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR0601MB3589; 23:yYN2SLuurRv04lAsAACKkV4PfLfahNsCITzIwhR?= =?us-ascii?Q?+VTk6IPnmcPZZyaY0MAQ8xoSiST+A0/kUieq2D7s+Cp826pIlrbGjqjAC4YX?= =?us-ascii?Q?5ccTKjBHL9AmSxCalBev0jjllL3RMWfVuJM6FFSnEpiuafCWyc3x4ty/z+X1?= =?us-ascii?Q?UJ1C4OccbcrHjur+ExXQCXU2GfVdMznsCkPWZ38K+kKG6Zmfx7G1BhKXUqAK?= =?us-ascii?Q?/gYfATPCdLR0dpkWiQmdG7hxHpAjqYGVM9NQem2+KfU+qL3ZAmcB+a2XCrfq?= =?us-ascii?Q?sIMBbdiIvEq5KBWHUWYqXitB+S8RRICtytgsqLDM+21tVtraPPxGdnJNgSf/?= =?us-ascii?Q?N25ST6deNgZEBFwvVPzB5Pbvdj+CT0E92pbAf/16XB/DCAAWRgqQv/sbs3JA?= =?us-ascii?Q?xmcaaAtXpLtEr6hW+1fv/+fvkdKlKhJIO1nPn/+KSsA0Q5kvALmb/kI3RLSn?= =?us-ascii?Q?pIMASDn//InI2pO47ObiTiplr0iWGMCAlhHqSFny1avmFQ7KgZbzn9AWvTTi?= =?us-ascii?Q?mY77jmDMo0ys98U09Fv34OomscYYlTtuOlYb7fERZa8AdaHKAL+qzHp9iobB?= =?us-ascii?Q?ba8wQh8SwCWTiaFHxuYc92XfARCIsiKnIMW9hIp/TTha3OzwPpUo87ZxbnXF?=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0xZz4MftRf9yDTFB1nOfjPdkptSeAJiW6iYfoWG28zzS2JJXtqZ5ZqyTNj3P2YU=; 24:5NKVR5ahAobxPof93KcYKSOiE7Y8IlSA0Ty7mStNyEtBr5pQSl28ys7idyDx7nUybkvH+Irgsm7XbaI3coVxuyTnt/I/lOh40TJnC71Ftlg=; 7:Rqleca1h8imlk8gTw2wzinTnXQL+vCrLF7CGUrF3Zu96PAxFDm7kBwjnKVoxrcwfAzU984V5y/xqku9ohBv2euWn8nLqvnn9GiMB8JkNH/qe2CfkyejGwXkSiZAGcXiNsV/1kdLCH2V5DjXyGwjM71z6/QeVYp4PVEL3StvXTdrSe2ErNFFgEewC40d+TjynDTVPTi78hxGOE2v0Lnks2+gPe+OJTFwSkGz/SYKZWSaXVnChowNTF4AwuJY/oH9F SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cypress.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2017 07:38:34.1172 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 977db0bd-0a83-4321-8bb8-08d5406a2f41 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 011addfc-2c09-450d-8938-e0bbc2dd2376 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR0601MB3589 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The buffer size of return of cap iovar is greater than 256 bytes in some firmwares. For instance, the return size of cap iovar is 271 bytes in 4373 13.10.246.79 firmare. It makes feature capability parsing failed because caps buffer is default value. So we enlarge caps buffer size to 512 bytes and add the error print for cap iovar error. Signed-off-by: Wright Feng Acked-by: Arend van Spriel --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c index 53ae302..47de35a 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c @@ -130,13 +130,19 @@ static void brcmf_feat_iovar_data_set(struct brcmf_if *ifp, } } +#define MAX_CAPS_BUFFER_SIZE 512 static void brcmf_feat_firmware_capabilities(struct brcmf_if *ifp) { - char caps[256]; + char caps[MAX_CAPS_BUFFER_SIZE]; enum brcmf_feat_id id; - int i; + int i, err; + + err = brcmf_fil_iovar_data_get(ifp, "cap", caps, sizeof(caps)); + if (err) { + brcmf_err("could not get firmware cap (%d)\n", err); + return; + } - brcmf_fil_iovar_data_get(ifp, "cap", caps, sizeof(caps)); brcmf_dbg(INFO, "[ %s]\n", caps); for (i = 0; i < ARRAY_SIZE(brcmf_fwcap_map); i++) {