* [PATCH] kmalloc check for drivers/media/video/i2c-parport.c (245ac16)
@ 2001-06-24 21:30 Rasmus Andersen
0 siblings, 0 replies; only message in thread
From: Rasmus Andersen @ 2001-06-24 21:30 UTC (permalink / raw)
To: philb; +Cc: linux-kernel
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-06-24 21:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-24 21:30 [PATCH] kmalloc check for drivers/media/video/i2c-parport.c (245ac16) Rasmus Andersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®