wifi: mac80211: use local ml_basic_elem in parsing

There's no need to store this pointer on the heap, it's
only used in a single function. Move it there. Also
clarify the comment referencing it, ml_basic_elem is
not actually relevant (any more.)

Link: https://patch.msgid.link/20260529102644.50187b7a6ca2.Ifef23bda96651eed0f5cd2c3ecd4817d2fb08af4@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg
2026-05-29 10:24:59 +02:00
parent 32e2231985
commit c93db0bfff

View File

@@ -54,9 +54,6 @@ struct ieee80211_elems_parse {
/* must be first for kfree to work */
struct ieee802_11_elems elems;
/* The basic Multi-Link element in the original elements */
const struct element *ml_basic_elem;
struct ieee80211_elem_defrag ml_reconf, ml_epcs;
bool inside_multilink;
@@ -947,6 +944,7 @@ ieee80211_prep_mle_link_parse(struct ieee80211_elems_parse *elems_parse,
{
struct ieee802_11_elems *elems = &elems_parse->elems;
struct ieee80211_mle_per_sta_profile *prof;
const struct element *ml_basic_elem = NULL;
const struct element *tmp, *ret;
ssize_t ml_len;
const u8 *end;
@@ -966,12 +964,11 @@ ieee80211_prep_mle_link_parse(struct ieee80211_elems_parse *elems_parse,
IEEE80211_ML_CONTROL_TYPE_BASIC)
continue;
elems_parse->ml_basic_elem = tmp;
ml_basic_elem = tmp;
break;
}
ml_len = cfg80211_defragment_element(elems_parse->ml_basic_elem,
elems->ie_start,
ml_len = cfg80211_defragment_element(ml_basic_elem, elems->ie_start,
elems->total_len,
elems_parse->scratch_pos,
elems_parse->scratch +
@@ -1130,7 +1127,10 @@ ieee802_11_parse_elems_full(struct ieee80211_elems_parse_params *params)
if (params->bss->transmitted_bss && !non_inherit)
non_inherit = (const void *)empty_non_inheritance;
} else {
/* must always parse to get elems_parse->ml_basic_elem */
/*
* Find the multi-link element and the non-inherit element inside
* the applicable profile, if requested by params->link_id >= 0.
*/
non_inherit = ieee80211_prep_mle_link_parse(elems_parse, params,
&sub);
inside_multilink = true;