Hi Brad,

This patch to 2.5.64 reduces the large stack usage in
log_device_info() [and makes it static to boot].

Please apply.

Thanks,
~Randy
patch_name:     cdceth_stack.patch
patch_version:  2003-03-16.21:13:20
author:         Randy.Dunlap <[EMAIL PROTECTED]>
description:    reduce large stack use in cdc-ether.c::log_device_info();
product:        Linux
product_versions: 2.5.64
changelog:      convert arrays to kmalloc-ed memory;
maintainer:     Brad Hards <[EMAIL PROTECTED]>
diffstat:       =
 drivers/usb/net/cdc-ether.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)


diff -Naur ./drivers/usb/net/cdc-ether.c%CDCSTK ./drivers/usb/net/cdc-ether.c
--- ./drivers/usb/net/cdc-ether.c%CDCSTK        Tue Mar  4 19:28:56 2003
+++ ./drivers/usb/net/cdc-ether.c       Sun Mar 16 21:07:07 2003
@@ -1064,15 +1064,23 @@
 // Used by driver's probe routine ////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////
 
-void log_device_info(ether_dev_t *ether_dev)
+static void log_device_info(ether_dev_t *ether_dev)
 {
        int len;
        int string_num;
-       unsigned char manu[256];
-       unsigned char prod[256];
-       unsigned char sern[256];
+       unsigned char *manu = NULL;
+       unsigned char *prod = NULL;
+       unsigned char *sern = NULL;
        unsigned char *mac_addr;
 
+       manu = kmalloc(256, GFP_KERNEL);
+       prod = kmalloc(256, GFP_KERNEL);
+       sern = kmalloc(256, GFP_KERNEL);
+       if (!manu || !prod || !sern) {
+               dbg("no mem for log_device_info");
+               goto fini;
+       }
+
        // Default empty strings in case we don't find a real one
        manu[0] = 0x00;
        prod[0] = 0x00;
@@ -1113,6 +1121,10 @@
              ether_dev->net->name, manu, prod, sern, mac_addr[0], 
              mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], 
              mac_addr[5] );
+fini:
+       kfree(manu);
+       kfree(prod);
+       kfree(sern);
 }
 
 /* Forward declaration */

Reply via email to