kmalloc check for drivers/media/video/i2c-parport.c (245ac16)
PATCH 1/1 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.
drivers/media/video/i2c-parport.c +4 -0
@@ -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 );
Signature · 5 lines
Regards,
Rasmus([email protected])
"A statesman... is a dead politician. Lord knows, we need more statesmen."
-- Bloom County