DORMANTno replies REVIEWED: 1 (0M)

1 review trailer.

[PATCH v4] wifi: cfg80211: Use kmemdup_array instead of kmemdup for multiple allocation

From: Yu Jiaoliang <hidden>
Date: 2024-08-22 07:48:04
Also in: linux-wireless, lkml
Subsystem: 802.11 (including cfg80211/nl80211), the rest · Maintainers: Johannes Berg, Linus Torvalds

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

Signed-off-by: Yu Jiaoliang <redacted>
Reviewed-by: Christophe JAILLET <redacted>
---
v2:
- Change sizeof(limits[0]) to sizeof(*limits)
- Fix title prefix

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

v4:
- Move the Signed-off-by and Reviewed-by information above
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help