Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

b43: Fix possible unaligned u32 access

Fix possible unaligned u32 access in b43_generate_plcp_hdr().
Unaligned data is read/write with a u32 pointer instead of using the
packed structure. Some versions of gcc ignore the "packed" attribute, if the
structure element is accessed through a local pointer.

Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Matthieu CASTET and committed by
John W. Linville
b52a033c 5ee58d7e

+2 -3
+2 -3
drivers/net/wireless/b43/xmit.c
··· 118 118 void b43_generate_plcp_hdr(struct b43_plcp_hdr4 *plcp, 119 119 const u16 octets, const u8 bitrate) 120 120 { 121 - __le32 *data = &(plcp->data); 122 121 __u8 *raw = plcp->raw; 123 122 124 123 if (b43_is_ofdm_rate(bitrate)) { ··· 126 127 d = b43_plcp_get_ratecode_ofdm(bitrate); 127 128 B43_WARN_ON(octets & 0xF000); 128 129 d |= (octets << 5); 129 - *data = cpu_to_le32(d); 130 + plcp->data = cpu_to_le32(d); 130 131 } else { 131 132 u32 plen; 132 133 ··· 140 141 raw[1] = 0x04; 141 142 } else 142 143 raw[1] = 0x04; 143 - *data |= cpu_to_le32(plen << 16); 144 + plcp->data |= cpu_to_le32(plen << 16); 144 145 raw[0] = b43_plcp_get_ratecode_cck(bitrate); 145 146 } 146 147 }