[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <272c9a0f-1e95-4c7c-9b84-a6b564d9e2bd@oss.qualcomm.com>
Date: Wed, 13 Aug 2025 11:35:45 -0700
From: Jeff Johnson <jeff.johnson@....qualcomm.com>
To: Dan Carpenter <dan.carpenter@...aro.org>,
Qianfeng Rong <rongqianfeng@...o.com>
Cc: Brian Norris <briannorris@...omium.org>,
Francesco Dolcini <francesco@...cini.it>,
Johannes Berg <johannes.berg@...el.com>,
Sascha Hauer <s.hauer@...gutronix.de>, Kalle Valo <kvalo@...nel.org>,
Aditya Kumar Singh <quic_adisi@...cinc.com>,
Rameshkumar Sundaram <quic_ramess@...cinc.com>,
Roopni Devanathan <quic_rdevanat@...cinc.com>,
"open list:MARVELL MWIFIEX WIRELESS DRIVER"
<linux-wireless@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 5/5] wifi: mwifiex: use vmalloc_array() to simplify code
On 8/12/2025 6:48 AM, Dan Carpenter wrote:
> On Tue, Aug 12, 2025 at 09:32:18PM +0800, Qianfeng Rong wrote:
>> Remove array_size() calls and replace vmalloc() with vmalloc_array() to
>> simplify the code.
>>
>> Signed-off-by: Qianfeng Rong <rongqianfeng@...o.com>
>> ---
>> drivers/net/wireless/marvell/mwifiex/cfg80211.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
>> index 3498743d5ec0..fb4183ff02a9 100644
>> --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
>> +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
>> @@ -4673,8 +4673,8 @@ int mwifiex_init_channel_scan_gap(struct mwifiex_adapter *adapter)
>> * additional active scan request for hidden SSIDs on passive channels.
>> */
>> adapter->num_in_chan_stats = 2 * (n_channels_bg + n_channels_a);
>> - adapter->chan_stats = vmalloc(array_size(sizeof(*adapter->chan_stats),
>> - adapter->num_in_chan_stats));
>> + adapter->chan_stats = vmalloc_array(adapter->num_in_chan_stats,
>> + sizeof(*adapter->chan_stats));
>
> n_channels_bg is 14
> n_channels_a is either 0 or 31 depending on if we're using BAND_A.
> sizeof(*adapter->chan_stats) is 10.
>
> So we're either allocating 280 or 900 bytes, which is quite small. We
> should just use kmalloc_array() instead of vmalloc_array().
Should transition from v*() to k*() be separate from transition from *malloc()
to *malloc_array()?
/jeff
Powered by blists - more mailing lists