lkml.org 
[lkml]   [2001]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] kmalloc check for drivers/media/video/i2c-parport.c (245ac16)
Hi.

The following patch tries to avoid a potential null pointer
dereference. It applies against 245-ac16 and 246p6. The
dereference was originally reported by the Stanford team.


--- linux-245-ac16-clean/drivers/media/video/i2c-parport.c Thu Jul 13 01:24:33 2000
+++ linux-245-ac16/drivers/media/video/i2c-parport.c Sun Jun 24 23:22:19 2001
@@ -74,6 +74,10 @@
{
struct parport_i2c_bus *b = kmalloc(sizeof(struct parport_i2c_bus),
GFP_KERNEL);
+ if (!b) {
+ printk(KERN_ERR __FUNCTION__ ": Memory allocation failed. Not attaching.\n");
+ return;
+ }
b->i2c = parport_i2c_bus_template;
b->i2c.data = parport_get_port (port);
strncpy(b->i2c.name, port->name, 32);
--
Regards,
Rasmus(rasmus@jaquet.dk)
"A statesman... is a dead politician. Lord knows, we need more statesmen."
-- Bloom County
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 12:55    [W:9.372 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site