mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rasmus Andersen <rasmus@jaquet.dk>
To: philb@gnu.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] kmalloc check for drivers/media/video/i2c-parport.c (245ac16)
Date: Sun, 24 Jun 2001 23:30:06 +0200	[thread overview]
Message-ID: <20010624233006.I847@jaquet.dk> (raw)

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

                 reply	other threads:[~2001-06-24 21:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010624233006.I847@jaquet.dk \
    --to=rasmus@jaquet.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=philb@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®