Skip to contentSkip to conversation

airo: reduce stack memory footpring

PATCH In review Frank Seidel 2 participants 2 messages Feb 25, 2009 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 airo: reduce stack memory footpring

From: Frank Seidel <[email protected]>

Applying kernel janitors todos (reduce stack footprint where possible) to airo wireless driver. (Before 1124 bytes on i386, now 876)

---
 drivers/net/wireless/airo.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/wireless/airo.c +6 -1
@@ -7031,11 +7031,15 @@ static int airo_get_aplist(struct net_de
 {
 	struct airo_info *local = dev->ml_priv;
 	struct sockaddr *address = (struct sockaddr *) extra;
-	struct iw_quality qual[IW_MAX_AP];
+	struct iw_quality *qual;
 	BSSListRid BSSList;
 	int i;
 	int loseSync = capable(CAP_NET_ADMIN) ? 1: -1;
 
+	qual = kmalloc(IW_MAX_AP * sizeof(*qual), GFP_KERNEL);
+	if (!qual)
+		return -ENOMEM;
+
 	for (i = 0; i < IW_MAX_AP; i++) {
 		u16 dBm;
 		if (readBSSListRid(local, loseSync, &BSSList))
@@ -7090,6 +7094,7 @@ static int airo_get_aplist(struct net_de
 	}
 	dwrq->length = i;
 
+	kfree(qual);
 	return 0;
 }
 
#1 lore raw

Sorry, $SUBJECT should of course be:
[PATCH][trivial] airo: reduce stack memory footprint