diff options
author | Marcin Slusarz <marcin.slusarz@gmail.com> | 2008-04-22 13:45:33 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-24 13:07:46 -0400 |
commit | a58858556deb03ea4a464f84fe888692867ce377 (patch) | |
tree | 715753daa1e59ff85ed4be0a1bb68387f1178f7a /drivers/media/video/ir-kbd-i2c.c | |
parent | 1c3bf598cf794558694c8beb0c8c7056a81dbe04 (diff) |
V4L/DVB (7286): limit stack usage of ir-kbd-i2c.c
ir_probe allocated struct i2c_client on stack;
it's pretty big structure, so allocate it with kzalloc
make checkstack output without this patch:
x059d ir_probe [ir-kbd-i2c]: 1000
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/ir-kbd-i2c.c')
-rw-r--r-- | drivers/media/video/ir-kbd-i2c.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index ba7a74979dfb..58a1ddddb09e 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c | |||
@@ -509,9 +509,9 @@ static int ir_probe(struct i2c_adapter *adap) | |||
509 | static const int probe_cx88[] = { 0x18, 0x6b, 0x71, -1 }; | 509 | static const int probe_cx88[] = { 0x18, 0x6b, 0x71, -1 }; |
510 | static const int probe_cx23885[] = { 0x6b, -1 }; | 510 | static const int probe_cx23885[] = { 0x6b, -1 }; |
511 | const int *probe = NULL; | 511 | const int *probe = NULL; |
512 | struct i2c_client c; | 512 | struct i2c_client *c; |
513 | unsigned char buf; | 513 | unsigned char buf; |
514 | int i,rc; | 514 | int i, rc; |
515 | 515 | ||
516 | switch (adap->id) { | 516 | switch (adap->id) { |
517 | case I2C_HW_B_BT848: | 517 | case I2C_HW_B_BT848: |
@@ -536,19 +536,23 @@ static int ir_probe(struct i2c_adapter *adap) | |||
536 | if (NULL == probe) | 536 | if (NULL == probe) |
537 | return 0; | 537 | return 0; |
538 | 538 | ||
539 | memset(&c,0,sizeof(c)); | 539 | c = kzalloc(sizeof(*c), GFP_KERNEL); |
540 | c.adapter = adap; | 540 | if (!c) |
541 | return -ENOMEM; | ||
542 | |||
543 | c->adapter = adap; | ||
541 | for (i = 0; -1 != probe[i]; i++) { | 544 | for (i = 0; -1 != probe[i]; i++) { |
542 | c.addr = probe[i]; | 545 | c->addr = probe[i]; |
543 | rc = i2c_master_recv(&c,&buf,0); | 546 | rc = i2c_master_recv(c, &buf, 0); |
544 | dprintk(1,"probe 0x%02x @ %s: %s\n", | 547 | dprintk(1,"probe 0x%02x @ %s: %s\n", |
545 | probe[i], adap->name, | 548 | probe[i], adap->name, |
546 | (0 == rc) ? "yes" : "no"); | 549 | (0 == rc) ? "yes" : "no"); |
547 | if (0 == rc) { | 550 | if (0 == rc) { |
548 | ir_attach(adap,probe[i],0,0); | 551 | ir_attach(adap, probe[i], 0, 0); |
549 | break; | 552 | break; |
550 | } | 553 | } |
551 | } | 554 | } |
555 | kfree(c); | ||
552 | return 0; | 556 | return 0; |
553 | } | 557 | } |
554 | 558 | ||