netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] wifi: cfg80211: Use kmemdup_array instead of kmemdup for multiple allocation
@ 2024-08-22  2:42 Yu Jiaoliang
  2024-08-22  6:59 ` Kalle Valo
  0 siblings, 1 reply; 3+ messages in thread
From: Yu Jiaoliang @ 2024-08-22  2:42 UTC (permalink / raw)
  To: Johannes Berg, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, linux-wireless, netdev, linux-kernel
  Cc: opensource.kernel

Let the kememdup_array() take care about multiplication and possible
overflows.

---
v2:
-Change sizeof(limits[0]) to sizeof(*limits)
-Fix title prefix

v3:
-Fix R-b tag
-Leave --- above this information

Signed-off-by: Yu Jiaoliang <yujiaoliang@vivo.com>
Reviewed-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 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..e7c1ac2a0f2d 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),
+				       GFP_KERNEL);
 		if (!limits)
 			return -ENOMEM;
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] wifi: cfg80211: Use kmemdup_array instead of kmemdup for multiple allocation
  2024-08-22  2:42 [PATCH v3] wifi: cfg80211: Use kmemdup_array instead of kmemdup for multiple allocation Yu Jiaoliang
@ 2024-08-22  6:59 ` Kalle Valo
  2024-08-23  7:56   ` 于佼良
  0 siblings, 1 reply; 3+ messages in thread
From: Kalle Valo @ 2024-08-22  6:59 UTC (permalink / raw)
  To: Yu Jiaoliang
  Cc: Johannes Berg, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, linux-wireless, netdev, linux-kernel,
	opensource.kernel

Yu Jiaoliang <yujiaoliang@vivo.com> writes:

> Let the kememdup_array() take care about multiplication and possible
> overflows.
>
> ---
> v2:
> -Change sizeof(limits[0]) to sizeof(*limits)
> -Fix title prefix
>
> v3:
> -Fix R-b tag
> -Leave --- above this information
>
> Signed-off-by: Yu Jiaoliang <yujiaoliang@vivo.com>
> Reviewed-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Now Signed-off-by and Reviewed-by are in the wrong location. Please
carefully read the wiki page below how to submit patches.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] wifi: cfg80211: Use kmemdup_array instead of kmemdup for multiple allocation
  2024-08-22  6:59 ` Kalle Valo
@ 2024-08-23  7:56   ` 于佼良
  0 siblings, 0 replies; 3+ messages in thread
From: 于佼良 @ 2024-08-23  7:56 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Johannes Berg, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, linux-wireless@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	opensource.kernel

在 2024/8/22 14:59, Kalle Valo 写道:
> [Some people who received this message don't often get email from kvalo@kernel.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> Yu Jiaoliang <yujiaoliang@vivo.com> writes:
>
>> Let the kememdup_array() take care about multiplication and possible
>> overflows.
>>
>> ---
>> v2:
>> -Change sizeof(limits[0]) to sizeof(*limits)
>> -Fix title prefix
>>
>> v3:
>> -Fix R-b tag
>> -Leave --- above this information
>>
>> Signed-off-by: Yu Jiaoliang <yujiaoliang@vivo.com>
>> Reviewed-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Now Signed-off-by and Reviewed-by are in the wrong location. Please
> carefully read the wiki page below how to submit patches.
>
> --
> https://patchwork.kernel.org/project/linux-wireless/list/
>
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

Hi Kalle,

I have updated the position of the changelog and submitted patch v4. 
Thank you.

Best Regards,

Yu


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-23  7:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-22  2:42 [PATCH v3] wifi: cfg80211: Use kmemdup_array instead of kmemdup for multiple allocation Yu Jiaoliang
2024-08-22  6:59 ` Kalle Valo
2024-08-23  7:56   ` 于佼良

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).