mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
5ee58d7e6a
commit
b52a033c2c
|
@ -118,7 +118,6 @@ u8 b43_plcp_get_ratecode_ofdm(const u8 bitrate)
|
||||||
void b43_generate_plcp_hdr(struct b43_plcp_hdr4 *plcp,
|
void b43_generate_plcp_hdr(struct b43_plcp_hdr4 *plcp,
|
||||||
const u16 octets, const u8 bitrate)
|
const u16 octets, const u8 bitrate)
|
||||||
{
|
{
|
||||||
__le32 *data = &(plcp->data);
|
|
||||||
__u8 *raw = plcp->raw;
|
__u8 *raw = plcp->raw;
|
||||||
|
|
||||||
if (b43_is_ofdm_rate(bitrate)) {
|
if (b43_is_ofdm_rate(bitrate)) {
|
||||||
|
@ -127,7 +126,7 @@ void b43_generate_plcp_hdr(struct b43_plcp_hdr4 *plcp,
|
||||||
d = b43_plcp_get_ratecode_ofdm(bitrate);
|
d = b43_plcp_get_ratecode_ofdm(bitrate);
|
||||||
B43_WARN_ON(octets & 0xF000);
|
B43_WARN_ON(octets & 0xF000);
|
||||||
d |= (octets << 5);
|
d |= (octets << 5);
|
||||||
*data = cpu_to_le32(d);
|
plcp->data = cpu_to_le32(d);
|
||||||
} else {
|
} else {
|
||||||
u32 plen;
|
u32 plen;
|
||||||
|
|
||||||
|
@ -141,7 +140,7 @@ void b43_generate_plcp_hdr(struct b43_plcp_hdr4 *plcp,
|
||||||
raw[1] = 0x04;
|
raw[1] = 0x04;
|
||||||
} else
|
} else
|
||||||
raw[1] = 0x04;
|
raw[1] = 0x04;
|
||||||
*data |= cpu_to_le32(plen << 16);
|
plcp->data |= cpu_to_le32(plen << 16);
|
||||||
raw[0] = b43_plcp_get_ratecode_cck(bitrate);
|
raw[0] = b43_plcp_get_ratecode_cck(bitrate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue