libertas: whack 2800 bytes of stack

Dan Williams dcbw at localhost.unroutablelocaldomain
Tue Nov 28 02:56:38 EST 2006


Commit:     fcf6b3773f0b7b6aa3f1e5c58417a9bffd5d9c06
Parent:     5847546f1a1382aee884fb60e9b999a0bcfa9510
commit fcf6b3773f0b7b6aa3f1e5c58417a9bffd5d9c06
Author:     Dan Williams <dcbw at localhost.localdomain>
AuthorDate: Wed Nov 15 12:31:36 2006 -0500
Commit:     Dan Williams <dcbw at localhost.localdomain>
CommitDate: Wed Nov 15 12:31:36 2006 -0500

    libertas: whack 2800 bytes of stack
    
    The scan channel list was a statically allocated 2800 byte array;
    dynamically allocate it instead.
---
 drivers/net/wireless/libertas/wlan_scan.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/libertas/wlan_scan.c b/drivers/net/wireless/libertas/wlan_scan.c
index 30d8ccc..7c06326 100644
--- a/drivers/net/wireless/libertas/wlan_scan.c
+++ b/drivers/net/wireless/libertas/wlan_scan.c
@@ -795,7 +795,7 @@ static int wlan_scan_networks(wlan_priva
 {
 	wlan_adapter *Adapter = priv->adapter;
 	struct MrvlIEtypes_ChanListParamSet *pChanTlvOut;
-	struct ChanScanParamSet scanChanList[WLAN_IOCTL_USER_SCAN_CHAN_MAX];
+	struct ChanScanParamSet * scan_chan_list = NULL;
 	struct wlan_scan_cmd_config * scan_cfg = NULL;
 	u8 keepPreviousScan;
 	u8 filteredScan;
@@ -805,12 +805,17 @@ static int wlan_scan_networks(wlan_priva
 
 	ENTER();
 
-	memset(scanChanList, 0x00, sizeof(scanChanList));
+	scan_chan_list = kzalloc(sizeof(struct ChanScanParamSet) * 
+				WLAN_IOCTL_USER_SCAN_CHAN_MAX, GFP_KERNEL);
+	if (scan_chan_list == NULL) {
+		ret = -ENOMEM;
+		goto out;
+	}
 
 	scan_cfg = wlan_scan_setup_scan_config(priv,
 					       pUserScanIn,
 					       &pChanTlvOut,
-					       scanChanList,
+					       scan_chan_list,
 					       &maxChanPerScan,
 					       &filteredScan,
 					       &scanCurrentChanOnly);
@@ -842,7 +847,7 @@ static int wlan_scan_networks(wlan_priva
 				     filteredScan,
 				     scan_cfg,
 				     pChanTlvOut,
-				     scanChanList);
+				     scan_chan_list);
 
 	/*  Process the resulting scan table:
 	 *    - Remove any bad ssids
@@ -859,6 +864,9 @@ out:
 	if (scan_cfg)
 		kfree(scan_cfg);
 
+	if (scan_chan_list)
+		kfree(scan_chan_list);
+
 	LEAVE();
 	return ret;
 }


More information about the Commits-kernel mailing list