From: "Arend van Spriel" <arend@broadcom.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org, "Arend van Spriel" <arend@broadcom.com>
Subject: [PATCH 10/22] brcm80211: use endian annotation for pmk related structure
Date: Wed, 12 Oct 2011 20:51:20 +0200 [thread overview]
Message-ID: <1318445492-24207-11-git-send-email-arend@broadcom.com> (raw)
In-Reply-To: <1318445492-24207-1-git-send-email-arend@broadcom.com>
The pairwise master key configuration is sent to the device. The
structure has been annotated for endianess checking.
Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
.../net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 34 ++++++++++++-------
.../net/wireless/brcm80211/include/brcmu_wifi.h | 2 +-
2 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
index 1218ed7..9e69cd7 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
@@ -2467,9 +2467,12 @@ brcmf_update_pmklist(struct net_device *ndev,
struct brcmf_cfg80211_pmk_list *pmk_list, s32 err)
{
int i, j;
+ int pmkid_len;
- WL_CONN("No of elements %d\n", pmk_list->pmkids.npmkid);
- for (i = 0; i < pmk_list->pmkids.npmkid; i++) {
+ pmkid_len = le32_to_cpu(pmk_list->pmkids.npmkid);
+
+ WL_CONN("No of elements %d\n", pmkid_len);
+ for (i = 0; i < pmkid_len; i++) {
WL_CONN("PMKID[%d]: %pM =\n", i,
&pmk_list->pmkids.pmkid[i].BSSID);
for (j = 0; j < WLAN_PMKID_LEN; j++)
@@ -2491,26 +2494,30 @@ brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *ndev,
struct pmkid_list *pmkids = &cfg_priv->pmk_list->pmkids;
s32 err = 0;
int i;
+ int pmkid_len;
WL_TRACE("Enter\n");
if (!check_sys_up(wiphy))
return -EIO;
- for (i = 0; i < pmkids->npmkid; i++)
+ pmkid_len = le32_to_cpu(pmkids->npmkid);
+ for (i = 0; i < pmkid_len; i++)
if (!memcmp(pmksa->bssid, pmkids->pmkid[i].BSSID, ETH_ALEN))
break;
if (i < WL_NUM_PMKIDS_MAX) {
memcpy(pmkids->pmkid[i].BSSID, pmksa->bssid, ETH_ALEN);
memcpy(pmkids->pmkid[i].PMKID, pmksa->pmkid, WLAN_PMKID_LEN);
- if (i == pmkids->npmkid)
- pmkids->npmkid++;
+ if (i == pmkid_len) {
+ pmkid_len++;
+ pmkids->npmkid = cpu_to_le32(pmkid_len);
+ }
} else
err = -EINVAL;
WL_CONN("set_pmksa,IW_PMKSA_ADD - PMKID: %pM =\n",
- pmkids->pmkid[pmkids->npmkid].BSSID);
+ pmkids->pmkid[pmkid_len].BSSID);
for (i = 0; i < WLAN_PMKID_LEN; i++)
- WL_CONN("%02x\n", pmkids->pmkid[pmkids->npmkid].PMKID[i]);
+ WL_CONN("%02x\n", pmkids->pmkid[pmkid_len].PMKID[i]);
err = brcmf_update_pmklist(ndev, cfg_priv->pmk_list, err);
@@ -2525,7 +2532,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev,
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
struct pmkid_list pmkid;
s32 err = 0;
- int i;
+ int i, pmkid_len;
WL_TRACE("Enter\n");
if (!check_sys_up(wiphy))
@@ -2539,17 +2546,18 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev,
for (i = 0; i < WLAN_PMKID_LEN; i++)
WL_CONN("%02x\n", pmkid.pmkid[0].PMKID[i]);
- for (i = 0; i < cfg_priv->pmk_list->pmkids.npmkid; i++)
+ pmkid_len = le32_to_cpu(cfg_priv->pmk_list->pmkids.npmkid);
+ for (i = 0; i < pmkid_len; i++)
if (!memcmp
(pmksa->bssid, &cfg_priv->pmk_list->pmkids.pmkid[i].BSSID,
ETH_ALEN))
break;
- if ((cfg_priv->pmk_list->pmkids.npmkid > 0)
- && (i < cfg_priv->pmk_list->pmkids.npmkid)) {
+ if ((pmkid_len > 0)
+ && (i < pmkid_len)) {
memset(&cfg_priv->pmk_list->pmkids.pmkid[i], 0,
sizeof(struct pmkid));
- for (; i < (cfg_priv->pmk_list->pmkids.npmkid - 1); i++) {
+ for (; i < (pmkid_len - 1); i++) {
memcpy(&cfg_priv->pmk_list->pmkids.pmkid[i].BSSID,
&cfg_priv->pmk_list->pmkids.pmkid[i + 1].BSSID,
ETH_ALEN);
@@ -2557,7 +2565,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev,
&cfg_priv->pmk_list->pmkids.pmkid[i + 1].PMKID,
WLAN_PMKID_LEN);
}
- cfg_priv->pmk_list->pmkids.npmkid--;
+ cfg_priv->pmk_list->pmkids.npmkid = cpu_to_le32(pmkid_len - 1);
} else
err = -EINVAL;
diff --git a/drivers/net/wireless/brcm80211/include/brcmu_wifi.h b/drivers/net/wireless/brcm80211/include/brcmu_wifi.h
index e98ed50..452bd42 100644
--- a/drivers/net/wireless/brcm80211/include/brcmu_wifi.h
+++ b/drivers/net/wireless/brcm80211/include/brcmu_wifi.h
@@ -258,7 +258,7 @@ struct pmkid {
};
struct pmkid_list {
- u32 npmkid;
+ __le32 npmkid;
struct pmkid pmkid[1];
};
--
1.7.4.1
next prev parent reply other threads:[~2011-10-12 18:51 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-12 18:51 [PATCH 00/22] brcm80211: mainline patch related cleanup Arend van Spriel
2011-10-12 18:51 ` [PATCH 01/22] brcm80211: smac: removed redundant timer function parameters Arend van Spriel
2011-10-12 18:51 ` [PATCH 02/22] brcm80211: smac: decreased timer callback irq level Arend van Spriel
2011-10-12 18:51 ` [PATCH 03/22] brcm80211: cleanup function prototypes Arend van Spriel
2011-10-12 18:51 ` [PATCH 04/22] brcm80211: remove sparse warning in fullmac debug function Arend van Spriel
2011-10-12 18:51 ` [PATCH 05/22] brcm80211: fix sparse endianess error in mac80211_if.c Arend van Spriel
2011-10-12 18:51 ` [PATCH 06/22] brcm80211: add endian annotation to packet filter structures Arend van Spriel
2011-10-12 18:51 ` [PATCH 07/22] brcm80211: rename variable in _brcmf_set_multicast_list() Arend van Spriel
2011-10-12 18:51 ` [PATCH 08/22] brcm80211: fix annotations in TOE configuration functions Arend van Spriel
2011-10-12 18:51 ` [PATCH 09/22] brcm80211: use endian annotations in scan related function Arend van Spriel
2011-10-12 18:51 ` Arend van Spriel [this message]
2011-10-12 18:51 ` [PATCH 11/22] brcm80211: use endian annotations for assoc ie length request Arend van Spriel
2011-10-12 18:51 ` [PATCH 12/22] brcm80211: use endian annotation for roaming related parameters Arend van Spriel
2011-10-12 18:51 ` [PATCH 13/22] brcm80211: use endian annotation for scan time configuration Arend van Spriel
2011-10-12 18:51 ` [PATCH 14/22] brcm80211: fmac: fixed weird indentation Arend van Spriel
2011-10-12 18:51 ` [PATCH 15/22] brcm80211: removed unused functions Arend van Spriel
2011-10-12 18:51 ` [PATCH 16/22] brcm80211: moved power conversion functions Arend van Spriel
2011-10-12 18:51 ` [PATCH 17/22] brcm80211: moved function brcmu_chipname Arend van Spriel
2011-10-12 18:51 ` [PATCH 18/22] brcm80211: moved function brcmu_parse_tlvs Arend van Spriel
2011-10-12 18:51 ` [PATCH 19/22] brcm80211: moved function brcmu_chspec_malformed Arend van Spriel
2011-10-12 18:51 ` [PATCH 20/22] brcm80211: moved function brcmu_mkiovar Arend van Spriel
2011-10-12 18:51 ` [PATCH 21/22] brcm80211: moved function brcmu_format_flags Arend van Spriel
2011-10-12 18:51 ` [PATCH 22/22] brcm80211: removed file wifi.c Arend van Spriel
2011-10-12 19:13 ` Johannes Berg
2011-10-12 19:20 ` Arend van Spriel
2011-10-12 19:28 ` Johannes Berg
2011-10-12 21:54 ` Luis R. Rodriguez
2011-10-13 8:51 ` Arend van Spriel
2011-10-13 18:08 ` Luis R. Rodriguez
2011-10-13 18:23 ` John W. Linville
2011-10-13 18:32 ` Arend van Spriel
2011-10-13 18:27 ` Arend van Spriel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1318445492-24207-11-git-send-email-arend@broadcom.com \
--to=arend@broadcom.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).