summaryrefslogtreecommitdiff
path: root/net/wireless
diff options
context:
space:
mode:
authorYu Jiaoliang <yujiaoliang@vivo.com>2024-08-22 15:47:43 +0800
committerJohannes Berg <johannes.berg@intel.com>2024-08-27 10:28:56 +0200
commit32bf7729d2e67aed4a6c537bf21d2023e3f39c45 (patch)
tree3e0890d23201b3b10b797551eef02818c95bc8fa /net/wireless
parent76364f3edfde60aa2fa20b578ba9b96797d7bff5 (diff)
wifi: cfg80211: Use kmemdup_array instead of kmemdup for multiple allocation
Let the kememdup_array() take care about multiplication and possible overflows. Signed-off-by: Yu Jiaoliang <yujiaoliang@vivo.com> Reviewed-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://patch.msgid.link/20240822074743.1366561-1-yujiaoliang@vivo.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/wireless/util.c b/net/wireless/util.c
index edeeb056fe4d..f49b55724f83 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -2437,8 +2437,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;