mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:46:16 +00:00
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>
This commit is contained in:
parent
76364f3edf
commit
32bf7729d2
@ -2437,7 +2437,7 @@ 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,
|
||||
limits = kmemdup_array(c->limits, c->n_limits, sizeof(*limits),
|
||||
GFP_KERNEL);
|
||||
if (!limits)
|
||||
return -ENOMEM;
|
||||
|
Loading…
Reference in New Issue
Block a user