Re: [PATCH] wifi: iwlwifi: mvm: Fix __counted_by usage in cfg80211_wowlan_nd_*

2024-11-17 Thread Kees Cook
On Thu, Jun 20, 2024 at 08:53:45PM +0200, Christophe JAILLET wrote: > Le 20/06/2024 à 20:08, Gustavo A. R. Silva a écrit : > > > > > > On 6/20/24 12:02, Gustavo A. R. Silva wrote: > > > > > > > My understanding is that 'match', is allocated by : > > > >  match = kzalloc(struct_size(match, ch

Re: [PATCH] wifi: iwlwifi: mvm: Fix __counted_by usage in cfg80211_wowlan_nd_*

2024-06-20 Thread Gustavo A. R. Silva
then match->n_channels updated here:   if (!match)   goto out_report_nd; +    match->n_channels = n_channels; Thanks for the explanation. This is what I was looking for, and I missed this line. Sorry for the noise. No worries. Glad to help. :) -- Gustavo

Re: [PATCH] wifi: iwlwifi: mvm: Fix __counted_by usage in cfg80211_wowlan_nd_*

2024-06-20 Thread Christophe JAILLET
Le 20/06/2024 à 20:08, Gustavo A. R. Silva a écrit : On 6/20/24 12:02, Gustavo A. R. Silva wrote: My understanding is that 'match', is allocated by :  match = kzalloc(struct_size(match, channels, n_channels), GFP_KERNEL); So match->n_channels is *0* when iwl_mvm_query_set_freqs() is c

Re: [PATCH] wifi: iwlwifi: mvm: Fix __counted_by usage in cfg80211_wowlan_nd_*

2024-06-20 Thread Gustavo A. R. Silva
On 6/20/24 12:02, Gustavo A. R. Silva wrote: My understanding is that 'match', is allocated by :  match = kzalloc(struct_size(match, channels, n_channels), GFP_KERNEL); So match->n_channels is *0* when iwl_mvm_query_set_freqs() is called. n_channels is updated in the line before calli

Re: [PATCH] wifi: iwlwifi: mvm: Fix __counted_by usage in cfg80211_wowlan_nd_*

2024-06-20 Thread Gustavo A. R. Silva
My understanding is that 'match', is allocated by : match = kzalloc(struct_size(match, channels, n_channels), GFP_KERNEL); So match->n_channels is *0* when iwl_mvm_query_set_freqs() is called. n_channels is updated in the line before calling kzalloc(): n_channels = iwl_mvm_query_num_ma

Re: [PATCH] wifi: iwlwifi: mvm: Fix __counted_by usage in cfg80211_wowlan_nd_*

2024-06-20 Thread Christophe JAILLET
Le 19/06/2024 à 23:12, Kees Cook a écrit : 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 res

Re: [PATCH] wifi: iwlwifi: mvm: Fix __counted_by usage in cfg80211_wowlan_nd_*

2024-06-19 Thread Gustavo A. R. Silva
On 19/06/24 23:12, Kees Cook wrote: 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

[PATCH] wifi: iwlwifi: mvm: Fix __counted_by usage in cfg80211_wowlan_nd_*

2024-06-19 Thread Kees Cook
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)