* [PATCH v2 wireless 1/3] wifi: carl9170: replace open-coded IE search with cfg80211_find_ie()
@ 2026-10-26 22:32 Tristan Madani
2026-10-27 18:43 ` Christian Lamparter
0 siblings, 1 reply; 2+ messages in thread
From: Tristan Madani @ 2026-10-26 22:32 UTC (permalink / raw)
To: Johannes Berg, Christian Lamparter, Stanislaw Gruszka
Cc: Ivo van Doorn, John W . Linville, Kees Cook, linux-wireless,
linux-kernel, stable, tristan
carl9170_find_ie() open-codes the IE search that cfg80211_find_ie()
already provides. Replace the hand-rolled function with
cfg80211_find_ie() at the single call site.
Fixes: a84fab3cbfdc4 ("carl9170: 802.11 rx/tx processing and usb backend")
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
drivers/net/wireless/ath/carl9170/rx.c | 27 ++++++--------------------
1 file changed, 6 insertions(+), 21 deletions(-)
diff --git a/drivers/net/wireless/ath/carl9170/rx.c b/drivers/net/wireless/ath/carl9170/rx.c
index fbe46a5e4e415..9db6ac9d6d3c0 100644
--- a/drivers/net/wireless/ath/carl9170/rx.c
+++ b/drivers/net/wireless/ath/carl9170/rx.c
@@ -490,25 +490,6 @@ static struct sk_buff *carl9170_rx_copy_data(u8 *buf, int len)
return skb;
}
-static u8 *carl9170_find_ie(u8 *data, unsigned int len, u8 ie)
-{
- struct ieee80211_mgmt *mgmt = (void *)data;
- u8 *pos, *end;
-
- pos = (u8 *)mgmt->u.beacon.variable;
- end = data + len;
- while (pos < end) {
- if (pos + 2 + pos[1] > end)
- return NULL;
-
- if (pos[0] == ie)
- return pos;
-
- pos += 2 + pos[1];
- }
- return NULL;
-}
-
/*
* NOTE:
*
@@ -521,9 +502,10 @@ static u8 *carl9170_find_ie(u8 *data, unsigned int len, u8 ie)
static void carl9170_ps_beacon(struct ar9170 *ar, void *data, unsigned int len)
{
struct ieee80211_hdr *hdr = data;
+ struct ieee80211_mgmt *mgmt = data;
struct ieee80211_tim_ie *tim_ie;
struct ath_common *common = &ar->common;
- u8 *tim;
+ const u8 *tim;
u8 tim_len;
bool cam;
@@ -541,7 +523,10 @@ static void carl9170_ps_beacon(struct ar9170 *ar, void *data, unsigned int len)
ar->ps.last_beacon = jiffies;
- tim = carl9170_find_ie(data, len - FCS_LEN, WLAN_EID_TIM);
+ tim = cfg80211_find_ie(WLAN_EID_TIM, mgmt->u.beacon.variable,
+ (len - FCS_LEN) -
+ offsetof(struct ieee80211_mgmt,
+ u.beacon.variable));
if (!tim)
return;
--
2.47.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2 wireless 1/3] wifi: carl9170: replace open-coded IE search with cfg80211_find_ie()
2026-10-26 22:32 [PATCH v2 wireless 1/3] wifi: carl9170: replace open-coded IE search with cfg80211_find_ie() Tristan Madani
@ 2026-10-27 18:43 ` Christian Lamparter
0 siblings, 0 replies; 2+ messages in thread
From: Christian Lamparter @ 2026-10-27 18:43 UTC (permalink / raw)
To: Tristan Madani, Johannes Berg, Stanislaw Gruszka
Cc: Ivo van Doorn, Kees Cook, linux-wireless, linux-kernel, tristan
On 10/26/26 11:32 PM, Tristan Madani wrote:
> carl9170_find_ie() open-codes the IE search that cfg80211_find_ie()
> already provides. Replace the hand-rolled function with
> cfg80211_find_ie() at the single call site.
>
> Fixes: a84fab3cbfdc4 ("carl9170: 802.11 rx/tx processing and usb backend")
> Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
Sure!
Acked-by: Christian Lamparter <chunkeey@gmail.com>
> ---
> drivers/net/wireless/ath/carl9170/rx.c | 27 ++++++--------------------
> 1 file changed, 6 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/carl9170/rx.c b/drivers/net/wireless/ath/carl9170/rx.c
> index fbe46a5e4e415..9db6ac9d6d3c0 100644
> --- a/drivers/net/wireless/ath/carl9170/rx.c
> +++ b/drivers/net/wireless/ath/carl9170/rx.c
> [...]> @@ -541,7 +523,10 @@ static void carl9170_ps_beacon(struct ar9170 *ar, void *data, unsigned int len)
>
> ar->ps.last_beacon = jiffies;
>
> - tim = carl9170_find_ie(data, len - FCS_LEN, WLAN_EID_TIM);
> + tim = cfg80211_find_ie(WLAN_EID_TIM, mgmt->u.beacon.variable,
> + (len - FCS_LEN) -
> + offsetof(struct ieee80211_mgmt,
> + u.beacon.variable));
nit:
If there ever will be a v3. You could consider that the 80 characters per line
is not a strict rule.
This is straight out of "Documentation/process/maintainer-tip.rst:
"The 80 character rule is not a strict rule, so please use common sense when
breaking lines. Especially format strings should never be broken up."
my 2¢:
tim = cfg80211_find_ie(WLAN_EID_TIM, mgmt->u.beacon.variable,
len - FCS_LEN - offsetof(struct ieee80211_mgmt, u.beacon.variable));
Cheers,
Christian
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-27 18:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-26 22:32 [PATCH v2 wireless 1/3] wifi: carl9170: replace open-coded IE search with cfg80211_find_ie() Tristan Madani
2026-10-27 18:43 ` Christian Lamparter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®