Skip to content

Commit ca91dc9

Browse files
chunyeowjmberg-intel
authored andcommitted
mac80211: use put_unaligned_le16 for precedence value in mesh
use put_unaligned_le16 for precedence value in mesh channel switch support Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 3751c4e commit ca91dc9

2 files changed

Lines changed: 2 additions & 7 deletions

File tree

‎net/mac80211/mesh.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -674,8 +674,6 @@ ieee80211_mesh_build_beacon(struct ieee80211_if_mesh *ifmsh)
674674
rcu_read_lock();
675675
csa = rcu_dereference(ifmsh->csa);
676676
if (csa) {
677-
__le16 pre_value;
678-
679677
pos = skb_put(skb, 13);
680678
memset(pos, 0, 13);
681679
*pos++ = WLAN_EID_CHANNEL_SWITCH;
@@ -697,8 +695,7 @@ ieee80211_mesh_build_beacon(struct ieee80211_if_mesh *ifmsh)
697695
WLAN_EID_CHAN_SWITCH_PARAM_TX_RESTRICT : 0x00;
698696
put_unaligned_le16(WLAN_REASON_MESH_CHAN, pos);
699697
pos += 2;
700-
pre_value = cpu_to_le16(ifmsh->pre_value);
701-
memcpy(pos, &pre_value, 2);
698+
put_unaligned_le16(ifmsh->pre_value, pos);
702699
pos += 2;
703700
}
704701
rcu_read_unlock();

‎net/mac80211/util.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2450,7 +2450,6 @@ int ieee80211_send_action_csa(struct ieee80211_sub_if_data *sdata,
24502450

24512451
if (ieee80211_vif_is_mesh(&sdata->vif)) {
24522452
struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
2453-
__le16 pre_value;
24542453

24552454
skb_put(skb, 8);
24562455
*pos++ = WLAN_EID_CHAN_SWITCH_PARAM; /* EID */
@@ -2466,8 +2465,7 @@ int ieee80211_send_action_csa(struct ieee80211_sub_if_data *sdata,
24662465
ifmsh->pre_value = 1;
24672466
else
24682467
ifmsh->pre_value++;
2469-
pre_value = cpu_to_le16(ifmsh->pre_value);
2470-
memcpy(pos, &pre_value, 2); /* Precedence Value */
2468+
put_unaligned_le16(ifmsh->pre_value, pos);/* Precedence Value */
24712469
pos += 2;
24722470
ifmsh->chsw_init = true;
24732471
}

0 commit comments

Comments
 (0)