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)
|
if (params->num_different_channels > c->num_different_channels)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
limits = kmemdup(c->limits, sizeof(limits[0]) * c->n_limits,
|
limits = kmemdup_array(c->limits, c->n_limits, sizeof(*limits),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!limits)
|
if (!limits)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
Loading…
Reference in New Issue
Block a user