Messages in this thread | | | Date | Wed, 25 Oct 2023 08:52:23 -0700 | Subject | Re: [RFC - is this a bug?] wifi: ath10k: Asking for some light on this, please :) | From | Jeff Johnson <> |
| |
On 10/24/2023 7:37 PM, Gustavo A. R. Silva wrote: > > > On 10/24/23 14:49, Johannes Berg wrote: >> On Tue, 2023-10-24 at 14:41 -0600, Gustavo A. R. Silva wrote: >>> >>> It seems we run into the same issue in the function below, even in the >>> case this `memset()` is unnecessary (which it seems it's not): >>> >>> 8920 memset(skb->data, 0, sizeof(*cmd)); >>> >>> Notice that if `cap->peer_chan_len == 0` or `cap->peer_chan_len == 1`, >>> in the original code, we have `len == sizeof(*cmd) == 128`: >> >> Right. >> >>> - /* tdls peer update cmd has place holder for one channel*/ >>> - chan_len = cap->peer_chan_len ? (cap->peer_chan_len - 1) : 0; >>> - >>> - len = sizeof(*cmd) + chan_len * sizeof(*chan); >>> + len = struct_size(cmd, peer_capab.peer_chan_list, >>> cap->peer_chan_len); >>> >>> skb = ath10k_wmi_alloc_skb(ar, len); >>> if (!skb) >>> >>> which makes `round_len == roundup(len, 4) == struct_size(cmd,...,...) >>> == 104` >>> when `cap->peer_chan_len == 0` >> >> And yeah, that's really the issue, it only matters for ==0. For a moment >> there I thought that doesn't even make sense, but it looks like it never >> even becomes non-zero. >> >> No idea then, sorry. You'd hope firmware doesn't care about the actual >> message size if the inner data says "0 entries", but who knows? And how >> many firmware versions are there? :) >> >> So I guess you'd want to stay compatible, even if it means having a >> >> chan_len = min(cap->peer_chan_len, 1); >> >> for the struct_size()? > > Yeah, that's an alternative. > > I'll wait for the maintainers to chime in and see if they have a different > opinion.
I'm seeing clarification from the development team.
/jeff
| |