netdev
[Top] [All Lists]

[PATCH] reduce stack usage for arlan

To: Jeff Garzik <jgarzik@xxxxxxxxx>
Subject: [PATCH] reduce stack usage for arlan
From: Jörn Engel <joern@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 8 Mar 2005 16:34:57 +0100
Cc: netdev@xxxxxxxxxxx
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mutt/1.3.28i
Jean Tourrilhes indicated that this driver is currently unmaintained.
Jeff, do you want this patch?

Jörn

-- 
Fancy algorithms are slow when n is small, and n is usually small.
Fancy algorithms have big constants. Until you know that n is
frequently going to be big, don't get fancy.
-- Rob Pike

SARLSTR is never called with nn bigger than 48.  This patch should be
safe and severly reduces stack consumption.

Signed-off-by: Jörn Engel <joern@xxxxxxxxxxxxxxxxxxxx>
---

 drivers/net/wireless/arlan-proc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

--- linux-2.6.10cow/drivers/net/wireless/arlan-proc.c~arlan_stack       
2004-09-04 22:59:04.000000000 +0200
+++ linux-2.6.10cow/drivers/net/wireless/arlan-proc.c   2005-02-03 
21:29:33.000000000 +0100
@@ -28,9 +28,9 @@
        }
 
 #define SARLSTR(var,nn) {\
-       char tmpStr[400];\
+       char tmpStr[50];\
        int  tmpLn = nn;\
-       if (nn > 399 ) tmpLn = 399; \
+       BUG_ON(tmpLn > 49);\
        memcpy(tmpStr,(char *) priva->conf->var,tmpLn);\
        tmpStr[tmpLn] = 0; \
        pos += sprintf(arlan_drive_info+pos, "%s\t=\t%s 
\n",#var,priva->conf->var);\

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] reduce stack usage for arlan, Jörn Engel <=