Skip to contentSkip to conversation

caif: fix NULL pointer check

PATCH In review Alan Cox 2 participants 2 messages Jul 24, 2012

Subsystems (2)
lore
Share & tools
lore

Alan Cox

author
#0 lore raw

PATCH 1/1 caif: fix NULL pointer check

From: Alan Cox <[email protected]>

Resolves-bug: http://bugzilla.kernel.org/show_bug?44441

---

 drivers/net/caif/caif_serial.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/net/caif/caif_serial.c +3 -0
index 8a3054b..7e84175 100644
@@ -325,6 +325,9 @@ static int ldisc_open(struct tty_struct *tty)
 
 	sprintf(name, "cf%s", tty->name);
 	dev = alloc_netdev(sizeof(*ser), name, caifdev_setup);
+	if (dev == NULL)
+		return -ENOMEM;
+
 	ser = netdev_priv(dev);
 	ser->tty = tty_kref_get(tty);
 	ser->dev = dev;
maintainer
#1 lore raw

From: Alan Cox <[email protected]>
Date: Tue, 24 Jul 2012 13:42:14 +0100

Quoted 5 lines

From: Alan Cox <[email protected]>

Resolves-bug: http://bugzilla.kernel.org/show_bug?44441

Applied and queued up for -stable.

drivers/net/caif/caif_serial.c static int ldisc_open(struct tty_struct *tty) · line 328

Quoted 1 line
drivers/net/caif/caif_serial.c +1 -0
+	if (dev == NULL)

I adjusted this to be "if (!dev)"