[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20080401164823.GB7654@cvg>
Date: Tue, 1 Apr 2008 20:48:23 +0400
From: Cyrill Gorcunov <gorcunov@...il.com>
To: LKML <linux-kernel@...r.kernel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Mauro Carvalho Chehab <mchehab@...radead.org>,
video4linux-list@...hat.com
Subject: [PATCH] bttv: Bt832 - fix possible NULL pointer deref
This patch does fix potential NULL pointer dereference
Signed-off-by: Cyrill Gorcunov <gorcunov@...il.com>
---
Index: linux-2.6.git/drivers/media/video/bt8xx/bt832.c
===================================================================
--- linux-2.6.git.orig/drivers/media/video/bt8xx/bt832.c 2008-01-21 19:35:13.000000000 +0300
+++ linux-2.6.git/drivers/media/video/bt8xx/bt832.c 2008-04-01 20:43:03.000000000 +0400
@@ -97,6 +97,11 @@ int bt832_init(struct i2c_client *i2c_cl
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) {
@@ -211,7 +216,12 @@ bt832_command(struct i2c_client *client,
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);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists