diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2008-04-01 15:48:23 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-06 16:13:18 -0400 |
commit | 4a8f3a5727c589a59bcaaca43dc1025b347b7a75 (patch) | |
tree | 8a9c366d6b474568496f4067a129b63017ece1df /drivers/media | |
parent | 6fdf5e67fe8d3c83500dad9acae985132c2459a3 (diff) |
V4L/DVB (7460): bttv: Bt832 - fix possible NULL pointer deref
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 'drivers/media')
-rw-r--r-- | drivers/media/video/bt8xx/bt832.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/media/video/bt8xx/bt832.c b/drivers/media/video/bt8xx/bt832.c index a51876137880..f92f06dec0d0 100644 --- a/drivers/media/video/bt8xx/bt832.c +++ b/drivers/media/video/bt8xx/bt832.c | |||
@@ -97,6 +97,11 @@ int bt832_init(struct i2c_client *i2c_client_s) | |||
97 | int rc; | 97 | int rc; |
98 | 98 | ||
99 | buf=kmalloc(65,GFP_KERNEL); | 99 | buf=kmalloc(65,GFP_KERNEL); |
100 | if (!buf) { | ||
101 | v4l_err(&t->client, | ||
102 | "Unable to allocate memory. Detaching.\n"); | ||
103 | return 0; | ||
104 | } | ||
100 | bt832_hexdump(i2c_client_s,buf); | 105 | bt832_hexdump(i2c_client_s,buf); |
101 | 106 | ||
102 | if(buf[0x40] != 0x31) { | 107 | if(buf[0x40] != 0x31) { |
@@ -211,7 +216,12 @@ bt832_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
211 | switch (cmd) { | 216 | switch (cmd) { |
212 | case BT832_HEXDUMP: { | 217 | case BT832_HEXDUMP: { |
213 | unsigned char *buf; | 218 | unsigned char *buf; |
214 | buf=kmalloc(65,GFP_KERNEL); | 219 | buf = kmalloc(65, GFP_KERNEL); |
220 | if (!buf) { | ||
221 | v4l_err(&t->client, | ||
222 | "Unable to allocate memory\n"); | ||
223 | break; | ||
224 | } | ||
215 | bt832_hexdump(&t->client,buf); | 225 | bt832_hexdump(&t->client,buf); |
216 | kfree(buf); | 226 | kfree(buf); |
217 | } | 227 | } |