From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Yu Jiaoliang <yujiaoliang@vivo.com>,
Johannes Berg <johannes@sipsolutions.net>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: opensource.kernel@vivo.com
Subject: Re: [PATCH v1] net: wireless: Use kmemdup_array instead of kmemdup for multiple allocation
Date: Wed, 21 Aug 2024 11:38:31 +0200 [thread overview]
Message-ID: <8316e533-241a-49ef-aac1-07ff01bf489f@wanadoo.fr> (raw)
In-Reply-To: <20240821072410.4065645-1-yujiaoliang@vivo.com>
Le 21/08/2024 à 09:24, Yu Jiaoliang a écrit :
> Let the kememdup_array() take care about multiplication and possible
> overflows.
>
> Signed-off-by: Yu Jiaoliang <yujiaoliang@vivo.com>
> ---
> net/wireless/util.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/wireless/util.c b/net/wireless/util.c
> index 9a7c3adc8a3b..6cf19dda5d2a 100644
> --- a/net/wireless/util.c
> +++ b/net/wireless/util.c
> @@ -2435,8 +2435,8 @@ int cfg80211_iter_combinations(struct wiphy *wiphy,
> if (params->num_different_channels > c->num_different_channels)
> continue;
>
> - limits = kmemdup(c->limits, sizeof(limits[0]) * c->n_limits,
> - GFP_KERNEL);
> + limits = kmemdup_array(c->limits, c->n_limits, sizeof(limits[0]),
Maybe sizeof(*limits) would be a more usual pattern?
CJ
> + GFP_KERNEL);
> if (!limits)
> return -ENOMEM;
>
next prev parent reply other threads:[~2024-08-21 11:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-21 7:24 Yu Jiaoliang
2024-08-21 9:38 ` Christophe JAILLET [this message]
2024-08-21 10:05 ` Kalle Valo
-- strict thread matches above, loose matches on Subject: below --
2024-08-21 7:20 Yu Jiaoliang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8316e533-241a-49ef-aac1-07ff01bf489f@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=johannes@sipsolutions.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=opensource.kernel@vivo.com \
--cc=pabeni@redhat.com \
--cc=yujiaoliang@vivo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®