From patchwork Thu Nov 15 13:24:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 1749251 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 AA4303FC8A for ; Thu, 15 Nov 2012 13:25:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1767758Ab2KONY6 (ORCPT ); Thu, 15 Nov 2012 08:24:58 -0500 Received: from mail-qa0-f46.google.com ([209.85.216.46]:49625 "EHLO mail-qa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1767745Ab2KONY6 (ORCPT ); Thu, 15 Nov 2012 08:24:58 -0500 Received: by mail-qa0-f46.google.com with SMTP id c11so2570066qad.19 for ; Thu, 15 Nov 2012 05:24:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=twIOepYHDABPA5UzYq5QDxB8/Bait9WoxNNal6PHvHY=; b=Onc4u5kle9tpZxu2WUCkl0U0ljT50UilA0xSfnIs0tVnxaCsKov8tBbVUzokZ7RnKi ECMte+AyciNCewEhaJu+hoa++24Rwo7ajayjZPAtpqzHZQINf90iPMVr7N3AFifCQ6gD AscSwKFF7tU0X4G6C/SXMvhq4CJsbafNyHUm94XNBZOiSuw49AOkTVwW/SnDtF2iL7pW vbMeTC09dungb1Oe+UfXepEsOCuyrUkeSLbO+9o9pVTxLSzlQ+iJnttv8qHFfxabyHiT 5jCldpZZfHNGdUcxOVXTjM6gK0u64oSD4HVBfGiB57O52qycWzp0dqibLJgourh+IDwa kvhA== MIME-Version: 1.0 Received: by 10.224.195.136 with SMTP id ec8mr989870qab.98.1352985897272; Thu, 15 Nov 2012 05:24:57 -0800 (PST) Received: by 10.229.126.165 with HTTP; Thu, 15 Nov 2012 05:24:57 -0800 (PST) Date: Thu, 15 Nov 2012 21:24:57 +0800 Message-ID: Subject: [PATCH] rtlwifi: use eth_zero_addr() to assign zero address From: Wei Yongjun To: Larry.Finger@lwfinger.net, chaoming_li@realsil.com.cn, linville@tuxdriver.com Cc: yongjun_wei@trendmicro.com.cn, linux-wireless@vger.kernel.org Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Wei Yongjun Using eth_zero_addr() to assign zero address insetad of memset() or an inefficient copy from a static array. Signed-off-by: Wei Yongjun --- drivers/net/wireless/rtlwifi/cam.c | 2 +- drivers/net/wireless/rtlwifi/core.c | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/wireless/rtlwifi/cam.c b/drivers/net/wireless/rtlwifi/cam.c index 5b4b4d4..4511a39 100644 --- a/drivers/net/wireless/rtlwifi/cam.c +++ b/drivers/net/wireless/rtlwifi/cam.c @@ -340,7 +340,7 @@ void rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr) if (((bitmap & BIT(0)) == BIT(0)) && (memcmp(addr, sta_addr, ETH_ALEN) == 0)) { /* Remove from HW Security CAM */ - memset(rtlpriv->sec.hwsec_cam_sta_addr[i], 0, ETH_ALEN); + eth_zero_addr(rtlpriv->sec.hwsec_cam_sta_addr[i]); rtlpriv->sec.hwsec_cam_bitmap &= ~(BIT(0) << i); RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "del CAM entry %d\n", i); diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c index a7c0e52..be33aa1 100644 --- a/drivers/net/wireless/rtlwifi/core.c +++ b/drivers/net/wireless/rtlwifi/core.c @@ -962,7 +962,6 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, int err = 0; u8 mac_addr[ETH_ALEN]; u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - u8 zero_addr[ETH_ALEN] = { 0 }; if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) { RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, @@ -1057,7 +1056,7 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, memcpy(rtlpriv->sec.key_buf[key_idx], key->key, key->keylen); rtlpriv->sec.key_len[key_idx] = key->keylen; - memcpy(mac_addr, zero_addr, ETH_ALEN); + eth_zero_addr(mac_addr); } else if (group_key) { /* group key */ RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "set group key\n"); @@ -1108,7 +1107,7 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, } memset(rtlpriv->sec.key_buf[key_idx], 0, key->keylen); rtlpriv->sec.key_len[key_idx] = 0; - memcpy(mac_addr, zero_addr, ETH_ALEN); + eth_zero_addr(mac_addr); /* *mac80211 will delete entrys one by one, *so don't use rtl_cam_reset_all_entry