From: Alan Cox Date: Tue, 24 Jul 2012 02:42:14 +0000 (+0000) Subject: caif: fix NULL pointer check X-Git-Tag: firefly_0821_release~7541^2~854 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4b53a23467b73b472f276d5530a103a736fe8ae1;p=firefly-linux-kernel-4.4.55.git caif: fix NULL pointer check [ Upstream commit c66b9b7d365444b433307ebb18734757cb668a02 ] Reported-by: Resolves-bug: http://bugzilla.kernel.org/show_bug?44441 Signed-off-by: Alan Cox Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c index 3df0c0f8b8bf..82b1802b1d3d 100644 --- a/drivers/net/caif/caif_serial.c +++ b/drivers/net/caif/caif_serial.c @@ -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) + return -ENOMEM; + ser = netdev_priv(dev); ser->tty = tty_kref_get(tty); ser->dev = dev;