aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuciano Coelho <coelho@ti.com>2011-05-18 04:42:03 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-05-19 13:54:17 -0400
commita2cd43c52aa5c676b03d575177536e05ac672c75 (patch)
treee62d1019851368daebb5cf99e1a6c25c2967f2df
parentd676ff493d9dfb8b34892214665028a8c85e2056 (diff)
nl80211: remove some stack variables in trigger_scan and start_sched_scan
Some stack variables (name *ssid and *channel) are only used to define the size of the memory block that needs to be allocated for the request structure in the nl80211_trigger_scan() and nl80211_start_sched_scan() functions. This is unnecessary because the sizes of the actual elements in the structure can be used instead. Signed-off-by: Luciano Coelho <coelho@ti.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--net/wireless/nl80211.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 2222ce08ee91..ec83f413a7ed 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3294,8 +3294,6 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
3294 struct cfg80211_registered_device *rdev = info->user_ptr[0]; 3294 struct cfg80211_registered_device *rdev = info->user_ptr[0];
3295 struct net_device *dev = info->user_ptr[1]; 3295 struct net_device *dev = info->user_ptr[1];
3296 struct cfg80211_scan_request *request; 3296 struct cfg80211_scan_request *request;
3297 struct cfg80211_ssid *ssid;
3298 struct ieee80211_channel *channel;
3299 struct nlattr *attr; 3297 struct nlattr *attr;
3300 struct wiphy *wiphy; 3298 struct wiphy *wiphy;
3301 int err, tmp, n_ssids = 0, n_channels, i; 3299 int err, tmp, n_ssids = 0, n_channels, i;
@@ -3342,8 +3340,8 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
3342 return -EINVAL; 3340 return -EINVAL;
3343 3341
3344 request = kzalloc(sizeof(*request) 3342 request = kzalloc(sizeof(*request)
3345 + sizeof(*ssid) * n_ssids 3343 + sizeof(*request->ssids) * n_ssids
3346 + sizeof(channel) * n_channels 3344 + sizeof(*request->channels) * n_channels
3347 + ie_len, GFP_KERNEL); 3345 + ie_len, GFP_KERNEL);
3348 if (!request) 3346 if (!request)
3349 return -ENOMEM; 3347 return -ENOMEM;
@@ -3449,8 +3447,6 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
3449 struct cfg80211_sched_scan_request *request; 3447 struct cfg80211_sched_scan_request *request;
3450 struct cfg80211_registered_device *rdev = info->user_ptr[0]; 3448 struct cfg80211_registered_device *rdev = info->user_ptr[0];
3451 struct net_device *dev = info->user_ptr[1]; 3449 struct net_device *dev = info->user_ptr[1];
3452 struct cfg80211_ssid *ssid;
3453 struct ieee80211_channel *channel;
3454 struct nlattr *attr; 3450 struct nlattr *attr;
3455 struct wiphy *wiphy; 3451 struct wiphy *wiphy;
3456 int err, tmp, n_ssids = 0, n_channels, i; 3452 int err, tmp, n_ssids = 0, n_channels, i;
@@ -3507,8 +3503,8 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
3507 return -EINVAL; 3503 return -EINVAL;
3508 3504
3509 request = kzalloc(sizeof(*request) 3505 request = kzalloc(sizeof(*request)
3510 + sizeof(*ssid) * n_ssids 3506 + sizeof(*request->ssids) * n_ssids
3511 + sizeof(channel) * n_channels 3507 + sizeof(*request->channels) * n_channels
3512 + ie_len, GFP_KERNEL); 3508 + ie_len, GFP_KERNEL);
3513 if (!request) 3509 if (!request)
3514 return -ENOMEM; 3510 return -ENOMEM;