mac80211: mesh_plink: use get_unaligned_le16 instead of memcpy

Use get_unaligned_le16 to access llid/plid.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Bob Copeland 2014-06-28 16:35:26 -04:00 committed by Johannes Berg
parent 53b954ee4a
commit f8134fed83

View File

@ -1001,7 +1001,6 @@ mesh_process_plink_frame(struct ieee80211_sub_if_data *sdata,
enum ieee80211_self_protected_actioncode ftype; enum ieee80211_self_protected_actioncode ftype;
u32 changed = 0; u32 changed = 0;
u8 ie_len = elems->peering_len; u8 ie_len = elems->peering_len;
__le16 _plid, _llid;
u16 plid, llid = 0; u16 plid, llid = 0;
if (!elems->peering) { if (!elems->peering) {
@ -1036,13 +1035,10 @@ mesh_process_plink_frame(struct ieee80211_sub_if_data *sdata,
/* Note the lines below are correct, the llid in the frame is the plid /* Note the lines below are correct, the llid in the frame is the plid
* from the point of view of this host. * from the point of view of this host.
*/ */
memcpy(&_plid, PLINK_GET_LLID(elems->peering), sizeof(__le16)); plid = get_unaligned_le16(PLINK_GET_LLID(elems->peering));
plid = le16_to_cpu(_plid);
if (ftype == WLAN_SP_MESH_PEERING_CONFIRM || if (ftype == WLAN_SP_MESH_PEERING_CONFIRM ||
(ftype == WLAN_SP_MESH_PEERING_CLOSE && ie_len == 8)) { (ftype == WLAN_SP_MESH_PEERING_CLOSE && ie_len == 8))
memcpy(&_llid, PLINK_GET_PLID(elems->peering), sizeof(__le16)); llid = get_unaligned_le16(PLINK_GET_PLID(elems->peering));
llid = le16_to_cpu(_llid);
}
/* WARNING: Only for sta pointer, is dropped & re-acquired */ /* WARNING: Only for sta pointer, is dropped & re-acquired */
rcu_read_lock(); rcu_read_lock();