[PATCH] drivers/char/i2c-parport.c kmalloc check

From: Arnaldo Carvalho de Melo (acme@conectiva.com.br)
Date: Sun Aug 13 2000 - 08:25:54 EST


Hi,

   Please take a look and consider applying.

                        - Arnaldo

--- linux-2.4.0-test7-pre3/drivers/char/i2c-parport.c Wed Jul 12 20:24:33 2000
+++ linux-2.4.0-test7-pre3.acme/drivers/char/i2c-parport.c Sun Aug 13 10:05:39 2000
@@ -15,6 +15,10 @@
  * D0 clock out
  * D1 data out
  * BUSY data in
+ *
+ * Changes:
+ * Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 08/14/2000
+ * - check kmalloc return in i2c_parport_attach
  */
 
 #include <linux/parport.h>
@@ -74,6 +78,11 @@
 {
   struct parport_i2c_bus *b = kmalloc(sizeof(struct parport_i2c_bus),
                                       GFP_KERNEL);
+
+ if (!b) {
+ printk(KERN_ERR "i2c: out of memory for %s\n", port->name);
+ return;
+ }
   b->i2c = parport_i2c_bus_template;
   b->i2c.data = parport_get_port (port);
   strncpy(b->i2c.name, port->name, 32);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Aug 15 2000 - 21:00:30 EST