Message ID | 20210517201932.8860-8-wgong@codeaurora.org (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Johannes Berg |
Headers | show |
Series | cfg80211/mac80211: Add support for 6GHZ STA for various modes : LPI, SP and VLP | expand |
On Mon, 2021-05-17 at 16:19 -0400, Wen Gong wrote: > This patch is to add the transmit power envelope element parse in > _ieee802_11_parse_elems_crc(), it maybe have more than one transmit > power envelope element in a beacon. This is really hard to read. I'm sure you're aware of https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#commit_messages Also, FWIW, "This patch" language is pointless. We all know we're talking about a patch. Or maybe even not, we may be reading the commit later on. > + case WLAN_EID_TX_POWER_ENVELOPE: > + if (elems->tx_pwr_env_num >= > ARRAY_SIZE(elems->tx_pwr_env)) > + break; > Seems to me this should do some validation on the actual element? It at least has to have _one_ octet, afaict? johannes
On 2021-07-23 17:33, Johannes Berg wrote: > On Mon, 2021-05-17 at 16:19 -0400, Wen Gong wrote: >> This patch is to add the transmit power envelope element parse in >> _ieee802_11_parse_elems_crc(), it maybe have more than one transmit >> power envelope element in a beacon. > > This is really hard to read. > > I'm sure you're aware of > https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#commit_messages > > Also, FWIW, "This patch" language is pointless. We all know we're > talking about a patch. Or maybe even not, we may be reading the commit > later on. will change it. > >> + case WLAN_EID_TX_POWER_ENVELOPE: >> + if (elems->tx_pwr_env_num >= >> ARRAY_SIZE(elems->tx_pwr_env)) >> + break; >> > > Seems to me this should do some validation on the actual element? It at > least has to have _one_ octet, afaict? > will change it. > johannes
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index ecda126a7026..22220e8dfdc7 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1507,6 +1507,7 @@ struct ieee802_11_elems { const struct ieee80211_he_spr *he_spr; const struct ieee80211_mu_edca_param_set *mu_edca_param_set; const struct ieee80211_he_6ghz_capa *he_6ghz_capa; + const struct ieee80211_tx_pwr_env *tx_pwr_env[IEEE80211_TPE_MAX_IE_COUNT]; const u8 *uora_element; const u8 *mesh_id; const u8 *peering; @@ -1557,6 +1558,8 @@ struct ieee802_11_elems { u8 perr_len; u8 country_elem_len; u8 bssid_index_len; + u8 tx_pwr_env_len[IEEE80211_TPE_MAX_IE_COUNT]; + u8 tx_pwr_env_num; /* whether a parse error occurred while retrieving these elements */ bool parse_error; diff --git a/net/mac80211/util.c b/net/mac80211/util.c index f58136e844a7..585d2eeb4470 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -1344,6 +1344,14 @@ _ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action, elems->rsnx = pos; elems->rsnx_len = elen; break; + case WLAN_EID_TX_POWER_ENVELOPE: + if (elems->tx_pwr_env_num >= ARRAY_SIZE(elems->tx_pwr_env)) + break; + + elems->tx_pwr_env[elems->tx_pwr_env_num] = (void *)pos; + elems->tx_pwr_env_len[elems->tx_pwr_env_num] = elen; + elems->tx_pwr_env_num++; + break; case WLAN_EID_EXTENSION: ieee80211_parse_extension_element(calc_crc ? &crc : NULL,
This patch is to add the transmit power envelope element parse in _ieee802_11_parse_elems_crc(), it maybe have more than one transmit power envelope element in a beacon. Signed-off-by: Wen Gong <wgong@codeaurora.org> --- net/mac80211/ieee80211_i.h | 3 +++ net/mac80211/util.c | 8 ++++++++ 2 files changed, 11 insertions(+)