From nobody Mon May 25 04:33:49 2026 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53E152DFF04 for ; Mon, 18 May 2026 21:18:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779139127; cv=none; b=puIASKMdtsRp22Pkkgk78RQr+z26Kf+QvBeTh8AQOqIhnI347Pc38N0a7oO/Bjknsw7N4N5hXez6D9+qd4XgI6cG30utbck6/XNht74ELkPEABELEv1w4SIu9DA+Rm+tLMuU3QdJQ2jCskz6CmITssWBTbHYiL3St4ELAPWDEAY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779139127; c=relaxed/simple; bh=g/xJZ+OYh1mkHmn3+sQ2z7XA33HLjy2TXP/ltrNVdjE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=NqIQh0DNAsZ4NKrCX0Ea5Xkh1MmpK4Qro9TkpOBPLJVkLs8pFPJTiZd6jS+ELLEbHRxxG5ZtQxVQ0O17/Nvn+37a/7fLAdD8uVHjklowqudz1i9trvEm7jtQN2sytpj9Sg4pMbHwqfqJ/4jc/Z34MtCH/R7EUyY6r9lyFRLH+SU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QTzT0fqj; arc=none smtp.client-ip=209.85.216.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QTzT0fqj" Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-3665a90bcd3so2861709a91.1 for ; Mon, 18 May 2026 14:18:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779139126; x=1779743926; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=DYl12Kfn/OxyVfyG979gVQDEq7mBiScEt37GaLdil1A=; b=QTzT0fqjDQ4fTAyk9w1haDp2lZCCvtTO7OejfYejXr4K0qO4DM/9DdZsgTStecQ33L D+AYq+1pzMi0nWRnAPeoxDxqeJx6aqaCcLtoAOrcUEF+uAStgBwhX7KhYHGSywcnj9vg vxmn0XDQDOsiupxpFGyYnEfxw3Y4W/xB0NnAGmQo6QJcRPDAiNhvCmdZmRLCJ+Uj/1uU iN1p9joGHtNmKqt8D2yM1aVPhGSPbX6acurkcEh68Ow5OYNEqDzDCHtcx+EQ72vjQsoE vqnasDsmBLj6GAFAg+0Jxur20JwRT9GMhb344dAnvHE1aVklxmxPz98md6Ot6HnnzVeB 65jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779139126; x=1779743926; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=DYl12Kfn/OxyVfyG979gVQDEq7mBiScEt37GaLdil1A=; b=MZSzSA1sIAj1kOtzZo+Ta8JA/n7W10Yhgw2m7ihzMR0UuT2ABNSF659lyIw88gBUu6 6sL6Al6NjGqVUjSYkdUtUnh3YdNL1IuHGX+6FaSAb2TuLcaZfkHoD5sQD2hDdb6k3sBy z6HZvlAebjP8ERLhSJu4LEcIB8WxaGMk+6SUVyKkRNiYDPnibGcrL59X6BZXCfuqNaWk Z7m7/lgkl3rP+YfyvOhyzJMqoemGEmWhBJfnkqyI4LxvPuQaIPwCDvFh4hSWFjqpt5pN DyF5lQlqYysri3C5GjHutL3YVLlGlxnKoyVV5j7n3bbuuxBikFW2x0EBzv883/F3kh3O VBUA== X-Forwarded-Encrypted: i=1; AFNElJ8aR2vCsN+0xpPbapASwS+BoH/zN8M8Dc7Bny5iJITd4e/fRZn9GWBviHOQ9wKiqYUAH+bGhp/wbiraSEQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yxz0sPf2GZHOvW7mVBiW/LmL/QvNGKp+FvhfMwhblUgSeiKPlDU B7WCRIRVhiWWbjJYh6hM756PR/zoN68sHzdmWwoD0SPsNDpItYGXGRKJAHeUyHKp X-Gm-Gg: Acq92OGsJIHnS0mGIrawxbjFa/L0hgzLhk6TAvED/UfALrVknW8MliH5w4zCuwWgKY1 ZL5BgJpbZgyfLK5lxCR4GhRLENxJpJSOOt9pFfVzK6nCl/6bs7egIMfpubtDU/8fyXGJZwr5WUx Urv0gUvBIwnofRJ+4OryM8oX8RnnzimwroDfcqo7r7h+LwxeJLVATA3nBmVfMStRIPds8+0xy+0 pHypk9K+JcmZDUB08suRz8IlpECQLDzPix6n89a5hrrWtpaJNcnPwk5luBb8gYsC6cY3MVgjyVN 9u8n0hPMXGe1zPTRtKz+4R1PIQ2VeaYyaOu7qz5P60pUpuKuDWmBmB18OiSnyiiktSA5BeszbbC heNdItJKK0ztJtphjAFuHMrZtQp/HzFDGp00mEI3f+OBjMpkZCs0M70GZCI5kMawYsqUeEpMufd 9XxwiVZSFhkcras+rJ17O8e7FCvXZaEb4O2n2Ns6TEaPfSuinKRSs6Si7JcOXcfWDU1TZEI/4ay qAX9Nrjjgf78eZB6Ha3zkss2N63XWexbTc= X-Received: by 2002:a17:90b:4c50:b0:369:d7c6:450a with SMTP id 98e67ed59e1d1-369d7c64a4bmr4286889a91.0.1779139125662; Mon, 18 May 2026 14:18:45 -0700 (PDT) Received: from ryzen ([2601:644:8000:5b5d:7285:c2ff:fe45:8a32]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3695157d963sm11466999a91.6.2026.05.18.14.18.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2026 14:18:44 -0700 (PDT) From: Rosen Penev To: linux-wireless@vger.kernel.org Cc: Brian Norris , Francesco Dolcini , Kees Cook , "Gustavo A. R. Silva" , linux-kernel@vger.kernel.org (open list), linux-hardening@vger.kernel.org (open list:KERNEL HARDENING (not covered by other areas):Keyword:\b__counted_by(_le|_be|_ptr)?\b) Subject: [PATCH wireless-next] wifi: mwifiex: Use flexible array for RX reorder table Date: Mon, 18 May 2026 14:18:26 -0700 Message-ID: <20260518211826.11245-1-rosenp@gmail.com> X-Mailer: git-send-email 2.54.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Embed the RX reorder pointer array in struct mwifiex_rx_reorder_tbl instead of allocating it separately. This ties the array to the reorder table lifetime and removes a separate allocation and cleanup path. Use kzalloc_flex() for this and move the counting variable assignment to after it as it does for GCC >=3D 15 already. Assisted-by: Codex:GPT-5.5 Signed-off-by: Rosen Penev --- .../wireless/marvell/mwifiex/11n_rxreorder.c | 20 +++---------------- drivers/net/wireless/marvell/mwifiex/main.h | 2 +- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c b/drivers= /net/wireless/marvell/mwifiex/11n_rxreorder.c index 610ec8302adf..a266f09cb763 100644 --- a/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c +++ b/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c @@ -213,7 +213,6 @@ mwifiex_del_rx_reorder_entry(struct mwifiex_private *pr= iv, list_del(&tbl->list); spin_unlock_bh(&priv->rx_reorder_tbl_lock); - kfree(tbl->rx_reorder_ptr); kfree(tbl); spin_lock_bh(&priv->adapter->rx_proc_lock); @@ -329,7 +328,6 @@ static void mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta, int tid, int win_size, int seq_num) { - int i; struct mwifiex_rx_reorder_tbl *tbl, *new_node; u16 last_seq =3D 0; struct mwifiex_sta_node *node; @@ -344,10 +342,12 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_priv= ate *priv, u8 *ta, return; } /* if !tbl then create one */ - new_node =3D kzalloc_obj(struct mwifiex_rx_reorder_tbl); + new_node =3D kzalloc_flex(*new_node, rx_reorder_ptr, win_size); if (!new_node) return; + new_node->win_size =3D win_size; + INIT_LIST_HEAD(&new_node->list); new_node->tid =3D tid; memcpy(new_node->ta, ta, ETH_ALEN); @@ -381,26 +381,12 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_priv= ate *priv, u8 *ta, new_node->flags |=3D RXREOR_INIT_WINDOW_SHIFT; } - new_node->win_size =3D win_size; - - new_node->rx_reorder_ptr =3D kcalloc(win_size, sizeof(void *), - GFP_KERNEL); - if (!new_node->rx_reorder_ptr) { - kfree(new_node); - mwifiex_dbg(priv->adapter, ERROR, - "%s: failed to alloc reorder_ptr\n", __func__); - return; - } - new_node->timer_context.ptr =3D new_node; new_node->timer_context.priv =3D priv; new_node->timer_context.timer_is_set =3D false; timer_setup(&new_node->timer_context.timer, mwifiex_flush_data, 0); - for (i =3D 0; i < win_size; ++i) - new_node->rx_reorder_ptr[i] =3D NULL; - spin_lock_bh(&priv->rx_reorder_tbl_lock); list_add_tail(&new_node->list, &priv->rx_reorder_tbl_ptr); spin_unlock_bh(&priv->rx_reorder_tbl_lock); diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wire= less/marvell/mwifiex/main.h index 27559e2ddc31..67da5daa48b4 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -708,10 +708,10 @@ struct mwifiex_rx_reorder_tbl { int init_win; int start_win; int win_size; - void **rx_reorder_ptr; struct reorder_tmr_cnxt timer_context; u8 amsdu; u8 flags; + void *rx_reorder_ptr[] __counted_by(win_size); }; struct mwifiex_bss_prio_node { -- 2.54.0