From: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
To: gregkh@linuxfoundation.org
Cc: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>,
dan.carpenter@oracle.com, joe@perches.com,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH v5 02/34] staging: rtl8192e: Make ethernet addresses properly aligned
Date: Sun, 31 May 2015 20:19:21 +0200 [thread overview]
Message-ID: <1433096393-9862-3-git-send-email-mateusz.kulikowski@gmail.com> (raw)
In-Reply-To: <1433096393-9862-1-git-send-email-mateusz.kulikowski@gmail.com>
Reorder ethernet addresses allocated on stack or in non-packed
structures to keep them aligned(2).
Use ETH_ALEN as array length in places where it was hardcoded to 6.
Alignment verified using pahole where possible and target-tested
with BUG_ON() trap in ether_addr_copy.
Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
---
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 3 +--
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 6 ++----
drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 4 ++--
drivers/staging/rtl8192e/rtl819x_Qos.h | 4 ++--
drivers/staging/rtl8192e/rtl819x_TS.h | 2 +-
drivers/staging/rtl8192e/rtllib.h | 10 +++++-----
drivers/staging/rtl8192e/rtllib_crypt_tkip.c | 3 ++-
drivers/staging/rtl8192e/rtllib_rx.c | 6 +++++-
drivers/staging/rtl8192e/rtllib_softmac.c | 4 ++--
drivers/staging/rtl8192e/rtllib_tx.c | 3 ++-
10 files changed, 24 insertions(+), 21 deletions(-)
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
index aad5cc9..926fca7 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
@@ -316,12 +316,11 @@ void rtl8192e_SetHwReg(struct net_device *dev, u8 variable, u8 *val)
static void rtl8192_read_eeprom_info(struct net_device *dev)
{
struct r8192_priv *priv = rtllib_priv(dev);
-
+ const u8 bMac_Tmp_Addr[ETH_ALEN] = {0x00, 0xe0, 0x4c, 0x00, 0x00, 0x01};
u8 tempval;
u8 ICVer8192, ICVer8256;
u16 i, usValue, IC_Version;
u16 EEPROMId;
- u8 bMac_Tmp_Addr[6] = {0x00, 0xe0, 0x4c, 0x00, 0x00, 0x01};
RT_TRACE(COMP_INIT, "====> rtl8192_read_eeprom_info\n");
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 6d60ac4..6f339cd 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -2573,8 +2573,7 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
int ret = -1;
struct rtllib_device *ieee = priv->rtllib;
u32 key[4];
- u8 broadcast_addr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
- u8 zero_addr[6] = {0};
+ const u8 broadcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
struct iw_point *p = &wrq->u.data;
struct ieee_param *ipw = NULL;
@@ -2611,8 +2610,7 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
}
if (ieee->pairwise_key_type) {
- if (memcmp(ieee->ap_mac_addr, zero_addr,
- 6) == 0)
+ if (is_zero_ether_addr(ieee->ap_mac_addr))
ieee->iw_mode = IW_MODE_ADHOC;
memcpy((u8 *)key, ipw->u.crypt.key, 16);
EnableHWSecurityConfig8192(dev);
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
index 8d6a109..43702df 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
@@ -987,8 +987,8 @@ static int r8192_wx_set_enc_ext(struct net_device *dev,
ret = rtllib_wx_set_encode_ext(ieee, info, wrqu, extra);
{
- u8 broadcast_addr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
- u8 zero[6] = {0};
+ const u8 broadcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+ const u8 zero[ETH_ALEN] = {0};
u32 key[4] = {0};
struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
struct iw_point *encoding = &wrqu->encoding;
diff --git a/drivers/staging/rtl8192e/rtl819x_Qos.h b/drivers/staging/rtl8192e/rtl819x_Qos.h
index 55ef7ec..b3e7dae 100644
--- a/drivers/staging/rtl8192e/rtl819x_Qos.h
+++ b/drivers/staging/rtl8192e/rtl819x_Qos.h
@@ -255,8 +255,8 @@ union qos_tclas {
u8 Priority;
u8 ClassifierType;
u8 Mask;
- u8 SrcAddr[6];
- u8 DstAddr[6];
+ u8 SrcAddr[ETH_ALEN];
+ u8 DstAddr[ETH_ALEN];
u16 Type;
} TYPE0_ETH;
diff --git a/drivers/staging/rtl8192e/rtl819x_TS.h b/drivers/staging/rtl8192e/rtl819x_TS.h
index 8601b1a..b3e721b 100644
--- a/drivers/staging/rtl8192e/rtl819x_TS.h
+++ b/drivers/staging/rtl8192e/rtl819x_TS.h
@@ -35,7 +35,7 @@ struct ts_common_info {
struct list_head List;
struct timer_list SetupTimer;
struct timer_list InactTimer;
- u8 Addr[6];
+ u8 Addr[ETH_ALEN];
union tspec_body TSpec;
union qos_tclas TClass[TCLAS_NUM];
u8 TClasProc;
diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index bfec4fd..411363c 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -1531,7 +1531,7 @@ struct rtllib_network {
u16 CcxRmState[2];
bool bMBssidValid;
u8 MBssidMask;
- u8 MBssid[6];
+ u8 MBssid[ETH_ALEN];
bool bWithCcxVerNum;
u8 BssCcxVerNumber;
/* These are network statistics */
@@ -1866,7 +1866,7 @@ struct rt_link_detect {
struct sw_cam_table {
- u8 macaddr[6];
+ u8 macaddr[ETH_ALEN];
bool bused;
u8 key_buf[16];
u16 key_type;
@@ -1912,10 +1912,10 @@ enum ratr_table_mode_8192s {
#define NUM_PMKID_CACHE 16
struct rt_pmkid_list {
- u8 bUsed;
- u8 Bssid[6];
+ u8 Bssid[ETH_ALEN];
u8 PMKID[16];
u8 SsidBuf[33];
+ u8 bUsed;
u8 *ssid_octet;
u16 ssid_length;
};
@@ -2083,7 +2083,7 @@ struct rtllib_device {
u8 *wpa_ie;
size_t wps_ie_len;
u8 *wps_ie;
- u8 ap_mac_addr[6];
+ u8 ap_mac_addr[ETH_ALEN];
u16 pairwise_key_type;
u16 group_key_type;
diff --git a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
index 656b4b3..cdad066 100644
--- a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
+++ b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
@@ -52,7 +52,8 @@ struct rtllib_tkip_data {
struct crypto_blkcipher *tx_tfm_arc4;
struct crypto_hash *tx_tfm_michael;
/* scratch buffers for virt_to_page() (crypto API) */
- u8 rx_hdr[16], tx_hdr[16];
+ u8 rx_hdr[16];
+ u8 tx_hdr[16];
};
static void *rtllib_tkip_init(int key_idx)
diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index bb789cc..3228bfd 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -1258,7 +1258,11 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb,
struct rx_ts_record *pTS = NULL;
u16 fc, sc, SeqNum = 0;
u8 type, stype, multicast = 0, unicast = 0, nr_subframes = 0, TID = 0;
- u8 dst[ETH_ALEN], src[ETH_ALEN], bssid[ETH_ALEN] = {0}, *payload;
+ u8 *payload;
+ u8 dst[ETH_ALEN];
+ u8 src[ETH_ALEN];
+ u8 bssid[ETH_ALEN] = {0};
+
size_t hdrlen = 0;
bool bToOtherSTA = false;
int ret = 0, i = 0;
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index cd758fe..051105d 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -1957,9 +1957,9 @@ static inline void rtllib_rx_auth_rq(struct rtllib_device *ieee,
static inline void rtllib_rx_assoc_rq(struct rtllib_device *ieee,
struct sk_buff *skb)
{
-
u8 dest[ETH_ALEN];
+
ieee->softmac_stats.rx_ass_rq++;
if (assoc_rq_parse(skb, dest) != -1)
rtllib_resp_to_assoc_rq(ieee, dest);
@@ -2912,7 +2912,7 @@ exit:
struct sk_buff *rtllib_get_beacon_(struct rtllib_device *ieee)
{
- u8 broadcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+ const u8 broadcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
struct sk_buff *skb;
struct rtllib_probe_response *b;
diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c
index 3b15963..b177d7b 100644
--- a/drivers/staging/rtl8192e/rtllib_tx.c
+++ b/drivers/staging/rtl8192e/rtllib_tx.c
@@ -579,8 +579,9 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
.seq_ctl = 0,
.qos_ctl = 0
};
- u8 dest[ETH_ALEN], src[ETH_ALEN];
int qos_actived = ieee->current_network.qos_data.active;
+ u8 dest[ETH_ALEN];
+ u8 src[ETH_ALEN];
struct lib80211_crypt_data *crypt = NULL;
struct cb_desc *tcb_desc;
u8 bIsMulticast = false;
--
1.8.4.1
next prev parent reply other threads:[~2015-05-31 18:21 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-31 18:19 [PATCH v5 00/34] staging: rtl8192e: Fix more checkpatch.pl warnings Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 01/34] staging: rtl8192e: accept const MAC address Mateusz Kulikowski
2015-05-31 18:19 ` Mateusz Kulikowski [this message]
2015-05-31 18:19 ` [PATCH v5 03/34] staging: rtl8192e: Fix PREFER_ETHER_ADDR_COPY warnings Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 04/34] staging: rtl8192e: Fix DEEP_INDENTATION warning in rtllib_parse_info_param() Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 05/34] staging: rtl8192e: Replace memcmp() with ether_addr_equal() Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 06/34] staging: rtl8192e: Remove rtllib_crypt.[ch] Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 07/34] staging: rtl8192e: Replace RTLLIB_DEBUG(DL_ERR) with netdev_*() Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 08/34] staging: rtl8192e: Remove RTLLIB_ERROR() and RTLLIB_WARNING() Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 09/34] staging: rtl8192e: Remove RTLLIB_DEBUG_WX() Mateusz Kulikowski
2015-05-31 21:31 ` Greg KH
2015-05-31 18:19 ` [PATCH v5 10/34] staging: rtl8192e: Simplify rtllib_process_probe_response() Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 11/34] staging: rtl8192e: Remove RTLLIB_DEBUG_SCAN() Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 12/34] staging: rtl8192e: Remove RTLLIB_DEBUG_(FRAG|EAP|DROP|STATE|TX|RX)() Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 13/34] staging: rtl8192e: Remove RTLLIB_DEBUG_QOS() Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 14/34] staging: rtl8192e: Remove RTLLIB_DEBUG_MGMT() Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 15/34] staging: rtl8192e: Remove RTLLIB_DEBUG_INFO() Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 16/34] staging: rtl8192e: Remove RTLLIB_DEBUG() Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 17/34] staging: rtl8192e: Remove RTLLIB_DEBUG_DATA() Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 18/34] staging: rtl8192e: Remove remains of RTLLIB_*_DEBUG() (including proc entry) Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 19/34] staging: rtl8192e: Remove assert() macro Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 20/34] staging: rtl8192e: Fix PREFER_PR_LEVEL warnings Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 21/34] staging: rtl8192e: Fix LONG_LINE warnings Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 22/34] staging: rtl8192e: Fix LONG_LING in rtllib_parse_info_param() Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 23/34] staging: rtl8192e: Remove unimplemented iwpriv handlers Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 24/34] staging: rtl8192e: Fix OOM_MESSAGE warnings Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 25/34] staging: rtl8192e: Remove unused rtl_crypto.h Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 26/34] staging: rtl8192e: Replace ?: with max_t Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 27/34] staging: rtl8192e: Replace ?: with min_t Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 28/34] staging: rtl8192e: Replace ?: with max Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 29/34] staging: rtl8192e: Remove unneeded RT_TRACE(COMP_ERR,...) Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 30/34] staging: rtl8192e: rtl8192_phy_checkBBAndRF(): Don't check MAC Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 31/34] staging: rtl8192e: Replace RT_TRACE(COMP_ERR, ...) with netdev_* Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 32/34] staging: rtl8192e: Fix trivial LONG_LINE errors Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 33/34] staging: rtl8192e: rtl8192E_suspend(): Fix WOL reporting Mateusz Kulikowski
2015-05-31 18:19 ` [PATCH v5 34/34] staging: rtl8192e: Fix SPACING error Mateusz Kulikowski
2015-05-31 18:39 ` [PATCH v5 00/34] staging: rtl8192e: Fix more checkpatch.pl warnings Joe Perches
2015-05-31 21:35 ` Greg KH
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=1433096393-9862-3-git-send-email-mateusz.kulikowski@gmail.com \
--to=mateusz.kulikowski@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®