1
0
Fork 0
alistair23-linux/drivers/staging/rtl8192e
Ksenija Stanojevic c63eee5460 Staging: rtl8192e: Use ether_addr_copy() instead of memcpy()
This patch replaces memcpy with ether_addr_copy.
Also pathole was used to make sure that arguments passed to ether_addr_copy
are aligned to u16.
First argument is iwe.u.ap_addr.sa_data i output of pahole is:
struct iw_event {
	__u16                      len;                  /*     0     2 */
	__u16                      cmd;                  /*     2     2 */

	/* XXX 4 bytes hole, try to pack */

	union iwreq_data           u;                    /*     8    16 */

	/* size: 24, cachelines: 1, members: 3 */
	/* sum members: 20, holes: 1, sum holes: 4 */
	/* last cacheline: 24 bytes */
};
and inside union iwreq_data u is sa_data:
struct sockaddr {
/* typedef sa_family_t -> __kernel_sa_family_t */ short unsigned int sa_family; /*     8     2 */
char       sa_data[14];                                          /*    10    14 */
} ap_addr; /*          16 */

sa_data is a char array of size 14, and the number of bytes copied using
ether_addr_copy() is 6.

Second argument is network->bssid and output of pahole is:
struct rtllib_network {
	u8                         bssid[6];             /*     0     6 */
	u8                         channel;              /*     6     1 */
	u8                         ssid[33];             /*     7    33 */
	u8                         ssid_len;             /*    40     1 */
	u8                         hidden_ssid[33];      /*    41    33 */
	/* --- cacheline 1 boundary (64 bytes) was 10 bytes ago --- */
	u8                         hidden_ssid_len;      /*    74     1 */

	/* XXX 1 byte hole, try to pack */

	struct rtllib_qos_data     qos_data;             /*    76    48 */
	bool                       bWithAironetIE;       /*   124     1 */
	bool                       bCkipSupported;       /*   125     1 */
	bool                       bCcxRmEnable;         /*   126     1 */

	/* XXX 1 byte hole, try to pack */

	/* --- cacheline 2 boundary (128 bytes) --- */
	u16                        CcxRmState[2];        /*   128     4 */
	bool                       bMBssidValid;         /*   132     1 */
	u8                         MBssidMask;           /*   133     1 */
	u8                         MBssid[6];            /*   134     6 */
	bool                       bWithCcxVerNum;       /*   140     1 */
	u8                         BssCcxVerNumber;      /*   141     1 */

	/* XXX 2 bytes hole, try to pack */

	struct rtllib_rx_stats     stats;                /*   144   120 */
	/* --- cacheline 4 boundary (256 bytes) was 8 bytes ago --- */
	u16                        capability;           /*   264     2 */
	u8                         rates[12];            /*   266    12 */
	u8                         rates_len;            /*   278     1 */
	u8                         rates_ex[16];         /*   279    16 */
	u8                         rates_ex_len;         /*   295     1 */
	long unsigned int          last_scanned;         /*   296     8 */
	u8                         mode;                 /*   304     1 */

	/* XXX 3 bytes hole, try to pack */

	u32                        flags;                /*   308     4 */
	u32                        last_associate;       /*   312     4 */
	u32                        time_stamp[2];        /*   316     8 */
	/* --- cacheline 5 boundary (320 bytes) was 4 bytes ago --- */
	u16                        beacon_interval;      /*   324     2 */
	u16                        listen_interval;      /*   326     2 */
	u16                        atim_window;          /*   328     2 */
	u8                         erp_value;            /*   330     1 */
	u8                         wpa_ie[64];           /*   331    64 */

	/* XXX 5 bytes hole, try to pack */

	/* --- cacheline 6 boundary (384 bytes) was 16 bytes ago --- */
	size_t                     wpa_ie_len;           /*   400     8 */
	u8                         rsn_ie[64];           /*   408    64 */
	/* --- cacheline 7 boundary (448 bytes) was 24 bytes ago --- */
	size_t                     rsn_ie_len;           /*   472     8 */
	u8                         wzc_ie[256];          /*   480   256 */
	/* --- cacheline 11 boundary (704 bytes) was 32 bytes ago --- */
	size_t                     wzc_ie_len;           /*   736     8 */
	struct rtllib_tim_parameters tim;                /*   744     2 */
	u8                         dtim_period;          /*   746     1 */
	u8                         dtim_data;            /*   747     1 */

	/* XXX 4 bytes hole, try to pack */

	u64                        last_dtim_sta_time;   /*   752     8 */
	u8                         wmm_info;             /*   760     1 */

	/* XXX 1 byte hole, try to pack */

	struct rtllib_wmm_ac_param wmm_param[4];         /*   762    16 */
	/* --- cacheline 12 boundary (768 bytes) was 10 bytes ago --- */
	u8                         Turbo_Enable;         /*   778     1 */

	/* XXX 1 byte hole, try to pack */

	u16                        CountryIeLen;         /*   780     2 */
	u8                         CountryIeBuf[255];    /*   782   255 */

	/* XXX 3 bytes hole, try to pack */

	/* --- cacheline 16 boundary (1024 bytes) was 16 bytes ago --- */
	struct bss_ht              bssht;                /*  1040    84 */
	/* --- cacheline 17 boundary (1088 bytes) was 36 bytes ago --- */
	bool                       broadcom_cap_exist;   /*  1124     1 */
	bool                       realtek_cap_exit;     /*  1125     1 */
	bool                       marvell_cap_exist;    /*  1126     1 */
	bool                       ralink_cap_exist;     /*  1127     1 */
	bool                       atheros_cap_exist;    /*  1128     1 */
	bool                       cisco_cap_exist;      /*  1129     1 */
	bool                       airgo_cap_exist;      /*  1130     1 */
	bool                       unknown_cap_exist;    /*  1131     1 */
	bool                       berp_info_valid;      /*  1132     1 */
	bool                       buseprotection;       /*  1133     1 */
	bool                       bIsNetgear854T;       /*  1134     1 */
	u8                         SignalStrength;       /*  1135     1 */
	u8                         RSSI;                 /*  1136     1 */

	/* XXX 7 bytes hole, try to pack */

	struct list_head           list;                 /*  1144    16 */
	/* --- cacheline 18 boundary (1152 bytes) was 8 bytes ago --- */

	/* size: 1160, cachelines: 19, members: 61 */
	/* sum members: 1132, holes: 10, sum holes: 28 */
	/* last cacheline: 8 bytes */
};

network->bssid is char array of size 6.

Issue found by checkpatch.pl

Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-01 17:07:43 -08:00
..
rtl8192e staging: rtl8192e: rewrite the right hand side of an assignment 2015-02-26 15:23:47 -08:00
Kconfig
Makefile
TODO
dot11d.c staging: rtl8192e: fixed coding style issues 2014-08-30 13:54:03 -07:00
dot11d.h staging:rtl8192e: Rewrite macro definition as static inline function. 2013-11-10 12:05:47 -08:00
license
rtl819x_BA.h
rtl819x_BAProc.c drivers: staging: rtl8192e: Include "asm/unaligned.h" instead of "access_ok.h" in "rtl819x_BAProc.c" 2014-12-02 16:47:11 -08:00
rtl819x_HT.h
rtl819x_HTProc.c staging: rtl8192e: rewrite the right hand side of an assignment 2015-02-26 15:23:47 -08:00
rtl819x_Qos.h rtl8192e: Removing unused defines in rtl819x_Qos.h 2013-12-20 11:41:28 -08:00
rtl819x_TS.h
rtl819x_TSProc.c Staging: rtl8192e: Fix space before semicolon warning 2014-09-19 17:14:30 -07:00
rtllib.h staging, rtl8192e, LLVMLinux: Remove unused prototype 2014-10-29 16:33:05 -07:00
rtllib_crypt.c Staging rtl8192e: Fixing checkpatch errors 2014-01-09 10:29:37 -08:00
rtllib_crypt.h
rtllib_crypt_ccmp.c Staging: rtl8192e: Fix style warnings relating to printk(KERN_DEBUG 2014-09-19 17:11:06 -07:00
rtllib_crypt_tkip.c staging: rtl8192e: fixed coding style issues 2014-08-30 13:54:03 -07:00
rtllib_crypt_wep.c Staging: rtl8192e: Fix printk debug style warning 2014-09-19 17:14:30 -07:00
rtllib_debug.h Staging rtl8192e: Correcting wrong usage of macro in r8192E_phy.c and removing corresponding warning in rtllib_debug.h 2014-01-09 10:32:18 -08:00
rtllib_endianfree.h rlt8192e: Removing unused defines in rltlib_endianfree.h 2013-12-20 11:41:28 -08:00
rtllib_module.c Staging: rtl8192e: Fixed unnecessary line continuation. 2015-02-07 17:25:43 +08:00
rtllib_rx.c staging: rtl8192e: rtllib_rx.c: Remove some unused functions 2015-01-17 14:13:31 -08:00
rtllib_softmac.c staging: rtl8192e: add missing tasklet_kill on remove path 2014-11-26 14:03:06 -08:00
rtllib_softmac_wx.c Staging: rtl8192e: Remove unused variable 2014-09-28 23:39:27 -04:00
rtllib_tx.c staging: rtl8192e: Remove unneeded void return 2014-10-02 11:56:43 -07:00
rtllib_wx.c Staging: rtl8192e: Use ether_addr_copy() instead of memcpy() 2015-03-01 17:07:43 -08:00