summaryrefslogtreecommitdiff
path: root/kernel/trace
diff options
context:
space:
mode:
authorKees Cook <kees@kernel.org>2024-06-19 14:12:45 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-01-09 13:33:52 +0100
commit19d8a4424168ef0a1d3be50c00632b03b33e97fd (patch)
treefc0e84e92ace3edc42fb97e10ff45098723bc0a5 /kernel/trace
parentca9d077350fa21897de8bf64cba23b198740aab5 (diff)
downloadlinux-19d8a4424168ef0a1d3be50c00632b03b33e97fd.tar.gz
linux-19d8a4424168ef0a1d3be50c00632b03b33e97fd.tar.bz2
linux-19d8a4424168ef0a1d3be50c00632b03b33e97fd.zip
wifi: iwlwifi: mvm: Fix __counted_by usage in cfg80211_wowlan_nd_*
commit cc0c53f4fac562efb3aca2bc493515e77642ae33 upstream. Both struct cfg80211_wowlan_nd_match and struct cfg80211_wowlan_nd_info pre-allocate space for channels and matches, but then may end up using fewer that the full allocation. Shrink the associated counter (n_channels and n_matches) after counting the results. This avoids compile-time (and run-time) warnings from __counted_by. (The counter member needs to be updated _before_ accessing the array index.) Seen with coming GCC 15: drivers/net/wireless/intel/iwlwifi/mvm/d3.c: In function 'iwl_mvm_query_set_freqs': drivers/net/wireless/intel/iwlwifi/mvm/d3.c:2877:66: warning: operation on 'match->n_channels' may be undefined [-Wsequence-point] 2877 | match->channels[match->n_channels++] = | ~~~~~~~~~~~~~~~~~^~ drivers/net/wireless/intel/iwlwifi/mvm/d3.c:2885:66: warning: operation on 'match->n_channels' may be undefined [-Wsequence-point] 2885 | match->channels[match->n_channels++] = | ~~~~~~~~~~~~~~~~~^~ drivers/net/wireless/intel/iwlwifi/mvm/d3.c: In function 'iwl_mvm_query_netdetect_reasons': drivers/net/wireless/intel/iwlwifi/mvm/d3.c:2982:58: warning: operation on 'net_detect->n_matches' may be undefined [-Wsequence-point] 2982 | net_detect->matches[net_detect->n_matches++] = match; | ~~~~~~~~~~~~~~~~~~~~~^~ Cc: stable@vger.kernel.org Fixes: aa4ec06c455d ("wifi: cfg80211: use __counted_by where appropriate") Signed-off-by: Kees Cook <kees@kernel.org> Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org> Link: https://patch.msgid.link/20240619211233.work.355-kees@kernel.org Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/trace')
0 files changed, 0 insertions, 0 deletions