Skip to content

Commit

Permalink
mac80211: mesh_plink: use get_unaligned_le16 instead of memcpy
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Bob Copeland authored and Johannes Berg committed Aug 26, 2014
1 parent 53b954e commit f8134fe
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions net/mac80211/mesh_plink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,6 @@ mesh_process_plink_frame(struct ieee80211_sub_if_data *sdata,
enum ieee80211_self_protected_actioncode ftype;
u32 changed = 0;
u8 ie_len = elems->peering_len;
__le16 _plid, _llid;
u16 plid, llid = 0;

if (!elems->peering) {
Expand Down Expand Up @@ -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
* from the point of view of this host.
*/
memcpy(&_plid, PLINK_GET_LLID(elems->peering), sizeof(__le16));
plid = le16_to_cpu(_plid);
plid = get_unaligned_le16(PLINK_GET_LLID(elems->peering));
if (ftype == WLAN_SP_MESH_PEERING_CONFIRM ||
(ftype == WLAN_SP_MESH_PEERING_CLOSE && ie_len == 8)) {
memcpy(&_llid, PLINK_GET_PLID(elems->peering), sizeof(__le16));
llid = le16_to_cpu(_llid);
}
(ftype == WLAN_SP_MESH_PEERING_CLOSE && ie_len == 8))
llid = get_unaligned_le16(PLINK_GET_PLID(elems->peering));

/* WARNING: Only for sta pointer, is dropped & re-acquired */
rcu_read_lock();
Expand Down

0 comments on commit f8134fe

Please sign in to comment.