summaryrefslogtreecommitdiff
path: root/net/wireless/reg.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-12-04 11:49:16 (GMT)
committerJohannes Berg <johannes.berg@intel.com>2013-01-03 12:01:19 (GMT)
commit82f20856304319d5a931846e0269eb911d52a905 (patch)
tree6a1e7e837f3d26ea40f1f73ac72ea979c9e85665 /net/wireless/reg.c
parent8a57fff0c178febbe28669a0ef68a8e3460a7589 (diff)
downloadlinux-fsl-qoriq-82f20856304319d5a931846e0269eb911d52a905.tar.xz
regulatory: don't allocate too much memory
There's no need to allocate one reg rule more than will be used, reduce the allocations. The allocation in nl80211 already doesn't allocate too much space. Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/reg.c')
-rw-r--r--net/wireless/reg.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 40646e8..62bf212 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -318,8 +318,9 @@ static int reg_copy_regd(const struct ieee80211_regdomain **dst_regd,
int size_of_regd = 0;
unsigned int i;
- size_of_regd = sizeof(struct ieee80211_regdomain) +
- ((src_regd->n_reg_rules + 1) * sizeof(struct ieee80211_reg_rule));
+ size_of_regd =
+ sizeof(struct ieee80211_regdomain) +
+ src_regd->n_reg_rules * sizeof(struct ieee80211_reg_rule);
regd = kzalloc(size_of_regd, GFP_KERNEL);
if (!regd)
@@ -641,7 +642,7 @@ static struct ieee80211_regdomain *regdom_intersect(
return NULL;
size_of_regd = sizeof(struct ieee80211_regdomain) +
- ((num_rules + 1) * sizeof(struct ieee80211_reg_rule));
+ num_rules * sizeof(struct ieee80211_reg_rule);
rd = kzalloc(size_of_regd, GFP_KERNEL);
if (!rd)