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>
This commit is contained in:
parent
6fdf5e67fe
commit
4a8f3a5727
|
@ -97,6 +97,11 @@ int bt832_init(struct i2c_client *i2c_client_s)
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
buf=kmalloc(65,GFP_KERNEL);
|
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);
|
bt832_hexdump(i2c_client_s,buf);
|
||||||
|
|
||||||
if(buf[0x40] != 0x31) {
|
if(buf[0x40] != 0x31) {
|
||||||
|
@ -211,7 +216,12 @@ bt832_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case BT832_HEXDUMP: {
|
case BT832_HEXDUMP: {
|
||||||
unsigned char *buf;
|
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);
|
bt832_hexdump(&t->client,buf);
|
||||||
kfree(buf);
|
kfree(buf);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue