Commit 789657f6 authored by Randy Dunlap's avatar Randy Dunlap Committed by Greg Kroah-Hartman

[PATCH] USB: reduce stack usage in cdc-ether

This patch to 2.5.64 reduces the large stack usage in
log_device_info() [and makes it static to boot].
parent 401abfce
...@@ -1064,15 +1064,23 @@ static void set_ethernet_addr( ether_dev_t *ether_dev ) ...@@ -1064,15 +1064,23 @@ static void set_ethernet_addr( ether_dev_t *ether_dev )
// Used by driver's probe routine //////////////////////////////////////////// // 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 len;
int string_num; int string_num;
unsigned char manu[256]; unsigned char *manu = NULL;
unsigned char prod[256]; unsigned char *prod = NULL;
unsigned char sern[256]; unsigned char *sern = NULL;
unsigned char *mac_addr; 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 // Default empty strings in case we don't find a real one
manu[0] = 0x00; manu[0] = 0x00;
prod[0] = 0x00; prod[0] = 0x00;
...@@ -1113,6 +1121,10 @@ void log_device_info(ether_dev_t *ether_dev) ...@@ -1113,6 +1121,10 @@ void log_device_info(ether_dev_t *ether_dev)
ether_dev->net->name, manu, prod, sern, mac_addr[0], ether_dev->net->name, manu, prod, sern, mac_addr[0],
mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4],
mac_addr[5] ); mac_addr[5] );
fini:
kfree(manu);
kfree(prod);
kfree(sern);
} }
/* Forward declaration */ /* Forward declaration */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment