diff options
author | Matthieu CASTET <castet.matthieu@free.fr> | 2009-06-04 17:18:33 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-06-10 13:27:53 -0400 |
commit | b52a033c2c501a8015df3727a4bd73389ccb1641 (patch) | |
tree | 57275be394a4031015d7978b3cc11dfd87d4ae9b /drivers/net/wireless/b43/xmit.c | |
parent | 5ee58d7e6ad019675b4090582aec4fa1180d8703 (diff) |
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>
Diffstat (limited to 'drivers/net/wireless/b43/xmit.c')
-rw-r--r-- | drivers/net/wireless/b43/xmit.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c index a63d88841df8..55f36a7254d9 100644 --- a/drivers/net/wireless/b43/xmit.c +++ b/drivers/net/wireless/b43/xmit.c | |||
@@ -118,7 +118,6 @@ u8 b43_plcp_get_ratecode_ofdm(const u8 bitrate) | |||
118 | void b43_generate_plcp_hdr(struct b43_plcp_hdr4 *plcp, | 118 | void b43_generate_plcp_hdr(struct b43_plcp_hdr4 *plcp, |
119 | const u16 octets, const u8 bitrate) | 119 | const u16 octets, const u8 bitrate) |
120 | { | 120 | { |
121 | __le32 *data = &(plcp->data); | ||
122 | __u8 *raw = plcp->raw; | 121 | __u8 *raw = plcp->raw; |
123 | 122 | ||
124 | if (b43_is_ofdm_rate(bitrate)) { | 123 | if (b43_is_ofdm_rate(bitrate)) { |
@@ -127,7 +126,7 @@ void b43_generate_plcp_hdr(struct b43_plcp_hdr4 *plcp, | |||
127 | d = b43_plcp_get_ratecode_ofdm(bitrate); | 126 | d = b43_plcp_get_ratecode_ofdm(bitrate); |
128 | B43_WARN_ON(octets & 0xF000); | 127 | B43_WARN_ON(octets & 0xF000); |
129 | d |= (octets << 5); | 128 | d |= (octets << 5); |
130 | *data = cpu_to_le32(d); | 129 | plcp->data = cpu_to_le32(d); |
131 | } else { | 130 | } else { |
132 | u32 plen; | 131 | u32 plen; |
133 | 132 | ||
@@ -141,7 +140,7 @@ void b43_generate_plcp_hdr(struct b43_plcp_hdr4 *plcp, | |||
141 | raw[1] = 0x04; | 140 | raw[1] = 0x04; |
142 | } else | 141 | } else |
143 | raw[1] = 0x04; | 142 | raw[1] = 0x04; |
144 | *data |= cpu_to_le32(plen << 16); | 143 | plcp->data |= cpu_to_le32(plen << 16); |
145 | raw[0] = b43_plcp_get_ratecode_cck(bitrate); | 144 | raw[0] = b43_plcp_get_ratecode_cck(bitrate); |
146 | } | 145 | } |
147 | } | 146 | } |