diff options
author | Christoph Fritz <chf.fritz@googlemail.com> | 2011-05-08 16:50:09 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-05-10 15:54:50 -0400 |
commit | b53575ecf939a4f752de87eabf1adbcfa4478a6c (patch) | |
tree | 0e98918a3602d0abd1ff6bcc5dea9cef0763c99d /drivers/net/wireless/mwifiex/scan.c | |
parent | 3ed3f49473985718ce51f84d990ed5b8b6472598 (diff) |
mwifiex: fix null derefs, mem leaks and trivia
This patch:
- adds kfree() where necessary
- prevents potential null dereferences
- makes use of kfree_skb()
- replaces -1 for failed kzallocs with -ENOMEM
Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
Reviewed-by: Kiran Divekar <dkiran@marvell.com>
Tested-by: Amitkumar Karwar <akarwar@marvell.com>
Acked-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex/scan.c')
-rw-r--r-- | drivers/net/wireless/mwifiex/scan.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c index 4968974f3427..5c22860fb40a 100644 --- a/drivers/net/wireless/mwifiex/scan.c +++ b/drivers/net/wireless/mwifiex/scan.c | |||
@@ -2283,7 +2283,7 @@ int mwifiex_scan_networks(struct mwifiex_private *priv, | |||
2283 | GFP_KERNEL); | 2283 | GFP_KERNEL); |
2284 | if (!scan_cfg_out) { | 2284 | if (!scan_cfg_out) { |
2285 | dev_err(adapter->dev, "failed to alloc scan_cfg_out\n"); | 2285 | dev_err(adapter->dev, "failed to alloc scan_cfg_out\n"); |
2286 | return -1; | 2286 | return -ENOMEM; |
2287 | } | 2287 | } |
2288 | 2288 | ||
2289 | buf_size = sizeof(struct mwifiex_chan_scan_param_set) * | 2289 | buf_size = sizeof(struct mwifiex_chan_scan_param_set) * |
@@ -2292,7 +2292,7 @@ int mwifiex_scan_networks(struct mwifiex_private *priv, | |||
2292 | if (!scan_chan_list) { | 2292 | if (!scan_chan_list) { |
2293 | dev_err(adapter->dev, "failed to alloc scan_chan_list\n"); | 2293 | dev_err(adapter->dev, "failed to alloc scan_chan_list\n"); |
2294 | kfree(scan_cfg_out); | 2294 | kfree(scan_cfg_out); |
2295 | return -1; | 2295 | return -ENOMEM; |
2296 | } | 2296 | } |
2297 | 2297 | ||
2298 | keep_previous_scan = false; | 2298 | keep_previous_scan = false; |
@@ -2491,7 +2491,7 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, | |||
2491 | GFP_KERNEL); | 2491 | GFP_KERNEL); |
2492 | if (!bss_new_entry) { | 2492 | if (!bss_new_entry) { |
2493 | dev_err(adapter->dev, " failed to alloc bss_new_entry\n"); | 2493 | dev_err(adapter->dev, " failed to alloc bss_new_entry\n"); |
2494 | return -1; | 2494 | return -ENOMEM; |
2495 | } | 2495 | } |
2496 | 2496 | ||
2497 | for (idx = 0; idx < scan_rsp->number_of_sets && bytes_left; idx++) { | 2497 | for (idx = 0; idx < scan_rsp->number_of_sets && bytes_left; idx++) { |
@@ -2881,7 +2881,7 @@ static int mwifiex_scan_specific_ssid(struct mwifiex_private *priv, | |||
2881 | scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), GFP_KERNEL); | 2881 | scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), GFP_KERNEL); |
2882 | if (!scan_cfg) { | 2882 | if (!scan_cfg) { |
2883 | dev_err(adapter->dev, "failed to alloc scan_cfg\n"); | 2883 | dev_err(adapter->dev, "failed to alloc scan_cfg\n"); |
2884 | return -1; | 2884 | return -ENOMEM; |
2885 | } | 2885 | } |
2886 | 2886 | ||
2887 | memcpy(scan_cfg->ssid_list[0].ssid, req_ssid->ssid, | 2887 | memcpy(scan_cfg->ssid_list[0].ssid, req_ssid->ssid, |