* [PATCH ath-next] wifi: wil6210: use kzalloc_flex in wil_tid_ampdu_rx
@ 2026-03-08 20:55 Rosen Penev
0 siblings, 0 replies; only message in thread
From: Rosen Penev @ 2026-03-08 20:55 UTC (permalink / raw)
To: linux-wireless
Cc: Kees Cook, Gustavo A. R. Silva, open list,
open list:KERNEL HARDENING (not covered by other areas):Keyword:b__counted_by(_le|_be)?b
Use it to simplify allocation and freeing.
Add __counted_by for extra runtime analysis.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/net/wireless/ath/wil6210/rx_reorder.c | 13 +++----------
drivers/net/wireless/ath/wil6210/wil6210.h | 4 ++--
2 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/drivers/net/wireless/ath/wil6210/rx_reorder.c b/drivers/net/wireless/ath/wil6210/rx_reorder.c
index 5841098ff8f9..3f11c6090234 100644
--- a/drivers/net/wireless/ath/wil6210/rx_reorder.c
+++ b/drivers/net/wireless/ath/wil6210/rx_reorder.c
@@ -241,21 +241,15 @@ void wil_rx_bar(struct wil6210_priv *wil, struct wil6210_vif *vif,
struct wil_tid_ampdu_rx *wil_tid_ampdu_rx_alloc(struct wil6210_priv *wil,
int size, u16 ssn)
{
- struct wil_tid_ampdu_rx *r = kzalloc_obj(*r);
+ struct wil_tid_ampdu_rx *r;
+ r = kzalloc_flex(*r, reorder_buf, size);
if (!r)
return NULL;
- r->reorder_buf =
- kzalloc_objs(struct sk_buff *, size);
- if (!r->reorder_buf) {
- kfree(r);
- return NULL;
- }
-
+ r->buf_size = size;
r->ssn = ssn;
r->head_seq_num = ssn;
- r->buf_size = size;
r->stored_mpdu_num = 0;
r->first_time = true;
r->mcast_last_seq = U16_MAX;
@@ -278,7 +272,6 @@ void wil_tid_ampdu_rx_free(struct wil6210_priv *wil,
for (i = 0; i < r->buf_size; i++)
kfree_skb(r->reorder_buf[i]);
- kfree(r->reorder_buf);
kfree(r);
}
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h
index 31e107c81e2d..768e6573cd29 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -659,7 +659,6 @@ struct pci_dev;
/**
* struct wil_tid_ampdu_rx - TID aggregation information (Rx).
*
- * @reorder_buf: buffer to reorder incoming aggregated MPDUs
* @last_rx: jiffies of last rx activity
* @head_seq_num: head sequence number in reordering buffer.
* @stored_mpdu_num: number of MPDUs in reordering buffer
@@ -672,9 +671,9 @@ struct pci_dev;
* @first_time: true when this buffer used 1-st time
* @mcast_last_seq: sequence number (SN) of last received multicast packet
* @drop_dup_mcast: duplicate multicast frames dropped for this reorder buffer
+ * @reorder_buf: buffer to reorder incoming aggregated MPDUs
*/
struct wil_tid_ampdu_rx {
- struct sk_buff **reorder_buf;
unsigned long last_rx;
u16 head_seq_num;
u16 stored_mpdu_num;
@@ -687,6 +686,7 @@ struct wil_tid_ampdu_rx {
bool first_time; /* is it 1-st time this buffer used? */
u16 mcast_last_seq; /* multicast dup detection */
unsigned long long drop_dup_mcast;
+ struct sk_buff *reorder_buf[] __counted_by(buf_size);
};
/**
--
2.53.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-03-08 20:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-08 20:55 [PATCH ath-next] wifi: wil6210: use kzalloc_flex in wil_tid_ampdu_rx Rosen Penev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox