lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Tue, 14 May 2019 08:16:32 +0300 From: Luciano Coelho <luciano.coelho@...el.com> To: "Gustavo A. R. Silva" <gustavo@...eddedor.com>, Johannes Berg <johannes.berg@...el.com>, Emmanuel Grumbach <emmanuel.grumbach@...el.com>, Intel Linux Wireless <linuxwifi@...el.com>, Kalle Valo <kvalo@...eaurora.org>, "David S. Miller" <davem@...emloft.net> Cc: linux-wireless@...r.kernel.org, netdev@...r.kernel.org, linux-kernel@...r.kernel.org Subject: Re: [PATCH][next] iwlwifi: d3: Use struct_size() helper On Wed, 2019-04-03 at 11:03 -0500, Gustavo A. R. Silva wrote: > Make use of the struct_size() helper instead of an open-coded version > in order to avoid any potential type mistakes, in particular in the > context in which this code is being used. > > So, change the following form: > > sizeof(*pattern_cmd) + > wowlan->n_patterns * sizeof(struct > iwlagn_wowlan_pattern) > > to : > > struct_size(pattern_cmd, patterns, wowlan->n_patterns) > > This code was detected with the help of Coccinelle. > > Signed-off-by: Gustavo A. R. Silva <gustavo@...eddedor.com> > --- > drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c > b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c > index 83fd7f93d9f5..99589b910bce 100644 > --- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c > +++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c > @@ -398,8 +398,7 @@ static int iwl_mvm_send_patterns(struct iwl_mvm > *mvm, > if (!wowlan->n_patterns) > return 0; > > - cmd.len[0] = sizeof(*pattern_cmd) + > - wowlan->n_patterns * sizeof(struct iwl_wowlan_pattern); > + cmd.len[0] = struct_size(pattern_cmd, patterns, wowlan- > >n_patterns); > > pattern_cmd = kmalloc(cmd.len[0], GFP_KERNEL); > if (!pattern_cmd) Thanks! Applied to our internal tree and it will reach the mainline following our normal upstreaming process. -- Cheers, Luca.
Powered by blists - more mailing lists