[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5a5b4961-904c-45e6-aca6-b58a122e2134@oss.qualcomm.com>
Date: Wed, 10 Dec 2025 14:46:31 +0800
From: Baochen Qiang <baochen.qiang@....qualcomm.com>
To: Alexandru Gagniuc <mr.nuke.me@...il.com>, ath11k@...ts.infradead.org,
Jeff Johnson <jjohnson@...nel.org>
Cc: linux-wireless@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] wifi: ath11k: move .max_tx_ring to struct
ath11k_hw_hal_params
On 12/10/2025 10:40 AM, Alexandru Gagniuc wrote:
> ".max_tx_ring" is an upper bounds to indexing ".tcl2wbm_rbm_map". It
> is initialized in, core.c, a different file than the array init. This
> spaghetti-like relation is fragile and not obvious. Accidentally
> setting ".max_tx_ring" too high leads to a hard to track out-of-
> bounds access and memory corruption.
>
> Clarify this dependency by moving ".max_tx_ring" adjacent to the array
> ".tcl2wbm_rbm_map". Use ARRAY_SIZE() instead of #defines to initialize
> the length field. Remove DP_TCL_NUM_RING_MAX_QCA6390, as it is no
> longer required.
>
> The intent is to make the code easier to understand rather than fix
> an existing bug.
>
Even the code chane works, I am not sure whether we should do this. Because, logically
max_tx_ring represents hardware capability which is static. However the change actually
implies max_tx_ring varies on tcl2wbm_rbm_map definition.
If we are going to add something to avoid the potential out-of-bound access or to improve
code readability, how about something like
ASSERT(hw_params.max_tx_ring <= ARRAR_SIZE(tcl2wbm_rbm_map))
Powered by blists - more mailing lists