Re: wifi: mac80211: make n_channels updated absolutely before accessing channels[]

From: Johannes Berg

Date: Wed Nov 12 2025 - 03:41:15 EST


On Wed, 2025-11-12 at 16:37 +0800, xu.xin16@xxxxxxxxxx wrote:
> From: xu xin <xu.xin16@xxxxxxxxxx>
>
> The commit 2663d0462eb3 ("wifi: mac80211: Avoid address calculations via out of
> bounds array indexing") said that req->n_channels must be set before
> req->channels[] can be used. But there&apos;s still the case that req.channels
> accessing was prior to n_channels++.
>
> This does not fix any visible bug, just making n_channels updated before
> accessing channels[] absolutely, to avoid potential UBSAN out of indexing
> warning.

I reverted the annotations, so this isn't necessary.

johannes