Skip to content

Commit 32bf772

Browse files
Yu Jiaoliangjmberg-intel
authored andcommitted
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>
1 parent 76364f3 commit 32bf772

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

net/wireless/util.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2437,8 +2437,8 @@ int cfg80211_iter_combinations(struct wiphy *wiphy,
24372437
if (params->num_different_channels > c->num_different_channels)
24382438
continue;
24392439

2440-
limits = kmemdup(c->limits, sizeof(limits[0]) * c->n_limits,
2441-
GFP_KERNEL);
2440+
limits = kmemdup_array(c->limits, c->n_limits, sizeof(*limits),
2441+
GFP_KERNEL);
24422442
if (!limits)
24432443
return -ENOMEM;
24442444

0 commit comments

Comments
 (0)