diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-01 16:48:23 +0000 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-01 16:48:23 +0000 |
commit | dacccb05d56ba22e51620a78a36a74ee1c96b5f4 (patch) | |
tree | cde1fa5ad3ec270406694f924ddf950589817d57 /linux/drivers/media | |
parent | 8a7929e609867aef708084c722c83c110a4d396a (diff) | |
download | mediapointer-dvb-s2-dacccb05d56ba22e51620a78a36a74ee1c96b5f4.tar.gz mediapointer-dvb-s2-dacccb05d56ba22e51620a78a36a74ee1c96b5f4.tar.bz2 |
bttv: Bt832 - fix possible NULL pointer deref
From: Cyrill Gorcunov <gorcunov@gmail.com>
This patch does fix potential NULL pointer dereference
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media')
-rw-r--r-- | linux/drivers/media/video/bt8xx/bt832.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/linux/drivers/media/video/bt8xx/bt832.c b/linux/drivers/media/video/bt8xx/bt832.c index d4201f8eb..4eefaba8f 100644 --- a/linux/drivers/media/video/bt8xx/bt832.c +++ b/linux/drivers/media/video/bt8xx/bt832.c @@ -108,6 +108,11 @@ int bt832_init(struct i2c_client *i2c_client_s) int rc; buf=kmalloc(65,GFP_KERNEL); + if (!buf) { + v4l_err(&t->client, + "Unable to allocate memory. Detaching.\n"); + return 0; + } bt832_hexdump(i2c_client_s,buf); if(buf[0x40] != 0x31) { @@ -250,7 +255,12 @@ bt832_command(struct i2c_client *client, unsigned int cmd, void *arg) switch (cmd) { case BT832_HEXDUMP: { unsigned char *buf; - buf=kmalloc(65,GFP_KERNEL); + buf = kmalloc(65, GFP_KERNEL); + if (!buf) { + v4l_err(&t->client, + "Unable to allocate memory\n"); + break; + } bt832_hexdump(&t->client,buf); kfree(buf); } |