From patchwork Fri Feb 6 14:28:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avinash Patil X-Patchwork-Id: 5789021 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 F1C56BF440 for ; Fri, 6 Feb 2015 08:59:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1971F2017D for ; Fri, 6 Feb 2015 08:59:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 21D3720109 for ; Fri, 6 Feb 2015 08:59:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753338AbbBFI6z (ORCPT ); Fri, 6 Feb 2015 03:58:55 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:40727 "EHLO mx0a-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751696AbbBFI6z (ORCPT ); Fri, 6 Feb 2015 03:58:55 -0500 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.14.5/8.14.5) with SMTP id t168wZhp025027; Fri, 6 Feb 2015 00:58:54 -0800 Received: from sc-owa04.marvell.com ([199.233.58.150]) by mx0a-0016f401.pphosted.com with ESMTP id 1sca52akks-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Fri, 06 Feb 2015 00:58:54 -0800 Received: from maili.marvell.com (10.93.76.83) by SC-OWA04.marvell.com (10.93.76.33) with Microsoft SMTP Server id 8.3.327.1; Fri, 6 Feb 2015 00:58:53 -0800 Received: from pe-lt950 (unknown [10.31.130.89]) by maili.marvell.com (Postfix) with ESMTP id C12F73F703F; Fri, 6 Feb 2015 00:58:52 -0800 (PST) Received: from pe-lt950 (localhost [127.0.0.1]) by pe-lt950 (8.14.7/8.14.7) with ESMTP id t16ESXA4010108; Fri, 6 Feb 2015 19:58:34 +0530 Received: (from root@localhost) by pe-lt950 (8.14.7/8.14.7/Submit) id t16ESTec010107; Fri, 6 Feb 2015 19:58:29 +0530 From: Avinash Patil To: CC: , , , , Avinash Patil Subject: [PATCH] mwifiex: use alloc_workqueue's format strings capabilities for WQ names Date: Fri, 6 Feb 2015 19:58:05 +0530 Message-ID: <1423232885-10073-1-git-send-email-patila@marvell.com> X-Mailer: git-send-email 1.8.1.4 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68, 1.0.33, 0.0.0000 definitions=2015-02-06_03:2015-02-06, 2015-02-06, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=3 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1502060094 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, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 alloc_workqueue() has string format formation ability e.g. wqname%ifname will be treated as wqnameifname. Use this and remove string operations while defining strings for workqueue names. Reported-by: Kees Cook Signed-off-by: Avinash Patil --- drivers/net/wireless/mwifiex/cfg80211.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index 41c8e25..5f3c1d3 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c @@ -2397,7 +2397,6 @@ mwifiex_setup_ht_caps(struct ieee80211_sta_ht_cap *ht_info, ht_info->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; } -#define MWIFIEX_MAX_WQ_LEN 30 /* * create a new virtual interface with the given name */ @@ -2411,7 +2410,6 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, struct mwifiex_private *priv; struct net_device *dev; void *mdev_priv; - char dfs_cac_str[MWIFIEX_MAX_WQ_LEN], dfs_chsw_str[MWIFIEX_MAX_WQ_LEN]; if (!adapter) return ERR_PTR(-EFAULT); @@ -2576,12 +2574,10 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, return ERR_PTR(-EFAULT); } - strcpy(dfs_cac_str, "MWIFIEX_DFS_CAC"); - strcat(dfs_cac_str, name); - priv->dfs_cac_workqueue = alloc_workqueue(dfs_cac_str, + priv->dfs_cac_workqueue = alloc_workqueue("MWIFIEX_DFS_CAC%s", WQ_HIGHPRI | WQ_MEM_RECLAIM | - WQ_UNBOUND, 1); + WQ_UNBOUND, 1, name); if (!priv->dfs_cac_workqueue) { wiphy_err(wiphy, "cannot register virtual network device\n"); free_netdev(dev); @@ -2594,11 +2590,9 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, INIT_DELAYED_WORK(&priv->dfs_cac_work, mwifiex_dfs_cac_work_queue); - strcpy(dfs_chsw_str, "MWIFIEX_DFS_CHSW"); - strcat(dfs_chsw_str, name); - priv->dfs_chan_sw_workqueue = alloc_workqueue(dfs_chsw_str, + priv->dfs_chan_sw_workqueue = alloc_workqueue("MWIFIEX_DFS_CHSW%s", WQ_HIGHPRI | WQ_UNBOUND | - WQ_MEM_RECLAIM, 1); + WQ_MEM_RECLAIM, 1, name); if (!priv->dfs_chan_sw_workqueue) { wiphy_err(wiphy, "cannot register virtual network device\n"); free_netdev(dev);