Commit 3d9aa543 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau
Browse files

wifi: mt76: mt7915: fix possible unaligned access in mt7915_mac_add_twt_setup



Fix possible unaligned pointer in mt7915_mac_add_twt_setup routine.

Reported-by: default avatarkernel test robot <lkp@intel.com>
Fixes: 3782b69d ("mt76: mt7915: introduce mt7915_mac_add_twt_setup routine")
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 765c69d4
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -2071,7 +2071,8 @@ void mt7915_mac_add_twt_setup(struct ieee80211_hw *hw,
	}

	flowid = ffs(~msta->twt.flowid_mask) - 1;
	le16p_replace_bits(&twt_agrt->req_type, flowid,
	twt_agrt->req_type &= ~cpu_to_le16(IEEE80211_TWT_REQTYPE_FLOWID);
	twt_agrt->req_type |= le16_encode_bits(flowid,
					       IEEE80211_TWT_REQTYPE_FLOWID);

	table_id = ffs(~dev->twt.table_mask) - 1;
@@ -2122,8 +2123,9 @@ void mt7915_mac_add_twt_setup(struct ieee80211_hw *hw,
unlock:
	mutex_unlock(&dev->mt76.mutex);
out:
	le16p_replace_bits(&twt_agrt->req_type, setup_cmd,
			   IEEE80211_TWT_REQTYPE_SETUP_CMD);
	twt_agrt->req_type &= ~cpu_to_le16(IEEE80211_TWT_REQTYPE_SETUP_CMD);
	twt_agrt->req_type |=
		le16_encode_bits(setup_cmd, IEEE80211_TWT_REQTYPE_SETUP_CMD);
	twt->control = (twt->control & IEEE80211_TWT_CONTROL_WAKE_DUR_UNIT) |
		       (twt->control & IEEE80211_TWT_CONTROL_RX_DISABLED);
}