> (gdb) ####################################
> (gdb) # c02a0a26, stack size: 416 bytes #
> (gdb) ####################################
> (gdb) 0xc02a0a26 is in pcmcia_device_query (drivers/pcmcia/ds.c:436).
----
this patch reduces the stack footprint of pcmcia_device_query() from 416
bytes to 36 bytes. (patch only build-tested)
Signed-off-by: Ingo Molnar <[email protected]>
Index: linux/drivers/pcmcia/ds.c
===================================================================
--- linux.orig/drivers/pcmcia/ds.c
+++ linux/drivers/pcmcia/ds.c
@@ -436,9 +436,13 @@ static int pcmcia_device_query(struct pc
{
cistpl_manfid_t manf_id;
cistpl_funcid_t func_id;
- cistpl_vers_1_t vers1;
+ cistpl_vers_1_t *vers1;
unsigned int i;
+ vers1 = kmalloc(sizeof(*vers1), GFP_KERNEL);
+ if (!vers1)
+ return -ENOMEM;
+
if (!pccard_read_tuple(p_dev->socket, p_dev->func,
CISTPL_MANFID, &manf_id)) {
p_dev->manf_id = manf_id.manf;
@@ -455,23 +459,30 @@ static int pcmcia_device_query(struct pc
/* rule of thumb: cards with no FUNCID, but with
* common memory device geometry information, are
* probably memory cards (from pcmcia-cs) */
- cistpl_device_geo_t devgeo;
+ cistpl_device_geo_t *devgeo;
+
+ devgeo = kmalloc(sizeof(*devgeo), GFP_KERNEL);
+ if (!devgeo) {
+ kfree(vers1);
+ return -ENOMEM;
+ }
if (!pccard_read_tuple(p_dev->socket, p_dev->func,
- CISTPL_DEVICE_GEO, &devgeo)) {
+ CISTPL_DEVICE_GEO, devgeo)) {
ds_dbg(0, "mem device geometry probably means "
"FUNCID_MEMORY\n");
p_dev->func_id = CISTPL_FUNCID_MEMORY;
p_dev->has_func_id = 1;
}
+ kfree(devgeo);
}
if (!pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_VERS_1,
- &vers1)) {
- for (i=0; i < vers1.ns; i++) {
+ vers1)) {
+ for (i=0; i < vers1->ns; i++) {
char *tmp;
unsigned int length;
- tmp = vers1.str + vers1.ofs[i];
+ tmp = vers1->str + vers1->ofs[i];
length = strlen(tmp) + 1;
if ((length < 3) || (length > 255))
@@ -487,6 +498,7 @@ static int pcmcia_device_query(struct pc
}
}
+ kfree(vers1);
return 0;
}
@@ -856,7 +868,9 @@ static int bind_request(struct pcmcia_bu
rescan:
p_dev->cardmgr = p_drv;
- pcmcia_device_query(p_dev);
+ ret = pcmcia_device_query(p_dev);
+ if (ret)
+ goto err_put_module;
/*
* Prevent this racing with a card insertion.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- References:
- Realtime Preemption, 2.6.12, Beginners Guide?
- Re: Realtime Preemption, 2.6.12, Beginners Guide?
- Re: Realtime Preemption, 2.6.12, Beginners Guide?
- Re: Realtime Preemption, 2.6.12, Beginners Guide?
- Re: Realtime Preemption, 2.6.12, Beginners Guide?
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
|
|