Jeff Johnson <quic_jjohnson@xxxxxxxxxxx> writes: > On 10/29/2024 6:22 AM, Aleksei Vetrov wrote: >> The channels array in the cfg80211_scan_request has a __counted_by >> attribute attached to it, which points to the n_channels variable. This >> attribute is used in bounds checking, and if it is not set before the >> array is filled, then the bounds sanitizer will issue a warning or a >> kernel panic if CONFIG_UBSAN_TRAP is set. >> >> This patch sets the size of allocated memory as the initial value for >> n_channels. It is updated with the actual number of added elements after >> the array is filled. >> >> Fixes: aa4ec06c455d ("wifi: cfg80211: use __counted_by where appropriate") >> Cc: stable@xxxxxxxxxxxxxxx >> Signed-off-by: Aleksei Vetrov <vvvvvv@xxxxxxxxxx> > Reviewed-by: Jeff Johnson <quic_jjohnson@xxxxxxxxxxx> > > And it is exactly this kind of issue why I'm not accepting any __counted_by() > changes in ath.git without actually testing the code that is modified. That's a good rule. If we ever manage to write that "wireless cleanup policy" document this is something we should add there. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches