1
0
Fork 0
alistair23-linux/drivers
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
..
accessibility
acpi Additional power management and ACPI updates for v3.20-rc1 2015-02-21 13:40:41 -08:00
amba ARM: 8256/1: driver coamba: add device binding path 'driver_override' 2015-02-10 10:23:15 +00:00
android
ata Merge branch 'for-3.20/drivers' of git://git.kernel.dk/linux-block 2015-02-12 14:30:53 -08:00
atm
auxdisplay
base driver core patches for 3.20-rc1 2015-02-15 11:11:47 -08:00
bcma
block Merge branch 'for-3.20' of git://git.infradead.org/users/kbusch/linux-nvme into for-linus 2015-02-20 22:12:02 -08:00
bluetooth TTY/Serial driver patches for 3.20-rc1 2015-02-15 11:37:02 -08:00
bus ARM: SoC platform changes 2015-02-17 09:27:54 -08:00
cdrom
char ipmi: Fix a memory ordering issue 2015-02-19 20:58:42 -06:00
clk The clock framework changes for 3.20 contain the usual driver additions, 2015-02-21 12:30:30 -08:00
clocksource ARM: SoC platform changes 2015-02-17 09:27:54 -08:00
connector
coresight coresight: fix function etm_writel_cp14() parameter order 2015-02-04 10:42:55 -08:00
cpufreq Additional power management and ACPI updates for v3.20-rc1 2015-02-21 13:40:41 -08:00
cpuidle Merge branches 'pnp', 'pm-cpuidle' and 'pm-cpufreq' 2015-02-21 04:29:16 +01:00
crypto Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma 2015-02-18 08:49:20 -08:00
dca
devfreq Merge branches 'pm-cpufreq', 'pm-cpuidle', 'pm-devfreq', 'pm-opp' and 'pm-tools' 2015-02-13 21:39:06 +01:00
dio
dma Staging: drivers: dma: Add space before ( 2015-02-26 15:14:33 -08:00
dma-buf
edac * A fix to sb_edac for proper detection on SNB machines 2015-02-19 11:18:14 -08:00
eisa
extcon
firewire firewire: core: use correct vendor/model IDs 2015-02-02 21:56:03 +01:00
firmware Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-02-21 10:41:29 -08:00
fmc
gpio Merge branch 'for-linus' of git://ftp.arm.linux.org.uk/~rmk/linux-arm 2015-02-12 08:51:56 -08:00
gpu Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2015-02-16 15:48:00 -08:00
hid Merge branches 'for-3.19/upstream-fixes', 'for-3.20/apple', 'for-3.20/betop', 'for-3.20/lenovo', 'for-3.20/logitech', 'for-3.20/rmi', 'for-3.20/upstream' and 'for-3.20/wacom' into for-linus 2015-02-09 11:17:45 +01:00
hsi
hv Char / Misc patches for 3.20-rc1 2015-02-15 10:48:44 -08:00
hwmon Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2015-02-19 10:36:45 -08:00
hwspinlock
i2c Merge branch 'i2c/for-3.20' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2015-02-21 12:41:50 -08:00
ide
idle intel_idle: Add ->enter_freeze callbacks 2015-02-15 19:40:09 +01:00
iio Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2015-02-19 10:36:45 -08:00
infiniband Merge branch 'for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2015-02-22 17:42:14 -08:00
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2015-02-21 12:59:04 -08:00
iommu IOMMU Updates for Linux v3.20 2015-02-12 09:16:56 -08:00
ipack
irqchip Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2015-02-21 19:41:38 -08:00
isdn Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2015-02-19 10:36:45 -08:00
leds leds: leds-gpio: Pass on error codes unmodified 2015-02-02 14:36:10 -08:00
lguest OK, this has the big virtio 1.0 implementation, as specified by OASIS. 2015-02-18 09:24:01 -08:00
macintosh
mailbox Merge branch 'mailbox-devel' of git://git.linaro.org/landing-teams/working/fujitsu/integration 2015-02-11 12:56:40 -08:00
mcb mcb: Fix error path of mcb_pci_probe 2015-02-03 15:48:51 -08:00
md - Significant dm-crypt CPU scalability performance improvements thanks 2015-02-21 13:28:45 -08:00
media mm: gup: use get_user_pages_unlocked 2015-02-11 17:06:05 -08:00
memory
memstick
message i2o: move to staging 2015-02-03 15:58:39 -08:00
mfd Changes to existing drivers: 2015-02-18 09:05:48 -08:00
misc Char / Misc patches for 3.20-rc1 2015-02-15 10:48:44 -08:00
mmc The clock framework changes for 3.20 contain the usual driver additions, 2015-02-21 12:30:30 -08:00
mtd MTD updates for 3.20-rc1 2015-02-18 08:01:44 -08:00
net Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2015-02-19 10:36:45 -08:00
nfc NFC: nci: Move NFCEE discovery logic 2015-02-04 09:15:18 +01:00
ntb
nubus
of PCI updates for v3.20: 2015-02-18 09:43:46 -08:00
oprofile
parisc
parport
pci Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2015-02-19 10:36:45 -08:00
pcmcia ARM: SoC driver updates 2015-02-17 09:38:59 -08:00
phy USB patches for 3.20-rc1 2015-02-15 10:24:55 -08:00
pinctrl This is the bulk of pin control changes for the v3.20 cycle: 2015-02-11 11:23:13 -08:00
platform Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-02-21 11:12:07 -08:00
pnp Merge branches 'pnp', 'pm-cpuidle' and 'pm-cpufreq' 2015-02-21 04:29:16 +01:00
power
powercap
pps
ps3
ptp
pwm pwm: tegra: Use NSEC_PER_SEC 2015-02-18 08:40:29 +01:00
rapidio Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma 2015-02-18 08:49:20 -08:00
ras
regulator Changes to existing drivers: 2015-02-18 09:05:48 -08:00
remoteproc
reset
rpmsg
rtc Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2015-02-19 10:36:45 -08:00
s390 Fairly small update, but there are some interesting new features. 2015-02-13 09:55:09 -08:00
sbus
scsi SCSI misc on 20150221 2015-02-21 19:16:42 -08:00
sfi
sh
sn
soc ARM: SoC driver updates 2015-02-17 09:38:59 -08:00
spi Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2015-02-19 10:36:45 -08:00
spmi
ssb treewide: Remove unnecessary SSB_DEVTABLE_END macro 2015-02-11 14:38:29 -08:00
staging Staging: rtl8192e: Use ether_addr_copy() instead of memcpy() 2015-03-01 17:07:43 -08:00
target Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2015-02-21 13:21:19 -08:00
tc
thermal thermal: exynos: fix: Check if data->tmu_read callback is present before read 2015-02-20 21:57:02 +08:00
thunderbolt
tty Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2015-02-19 10:36:45 -08:00
uio
usb Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2015-02-19 10:36:45 -08:00
uwb USB patches for 3.20-rc1 2015-02-15 10:24:55 -08:00
vfio vfio-pci: Add device request interface 2015-02-10 12:38:14 -07:00
vhost Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2015-02-21 13:21:19 -08:00
video mm: gup: use get_user_pages_unlocked 2015-02-11 17:06:05 -08:00
virt
virtio virtio: don't set VIRTIO_CONFIG_S_DRIVER_OK twice. 2015-02-17 16:19:29 +10:30
vlynq
vme
w1
watchdog watchdog: bcm47xx_wdt.c: allow enabling on BCM5301X arch 2015-02-17 21:34:13 +01:00
xen SCSI misc on 20150209 2015-02-11 10:28:45 -08:00
zorro
Kconfig i2o: move to staging 2015-02-03 15:58:39 -08:00
Makefile