summaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/of_serial.c
diff options
context:
space:
mode:
authorJingchang Lu <jingchang.lu@freescale.com>2014-10-21 16:50:21 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-05 20:12:02 -0800
commit7e12e675c17982a8b3cc91314a68f4c4d1bceb92 (patch)
treefac5e093a77324a06830339e4ca8d2dee0d4fabb /drivers/tty/serial/of_serial.c
parent9e326f78713a4421fe11afc2ddeac07698fac131 (diff)
downloadlinux-7e12e675c17982a8b3cc91314a68f4c4d1bceb92.tar.gz
linux-7e12e675c17982a8b3cc91314a68f4c4d1bceb92.tar.bz2
linux-7e12e675c17982a8b3cc91314a68f4c4d1bceb92.zip
serial: of-serial: fix uninitialized kmalloc variable
The info pointer points to an uninitialized kmalloced space. If a device doesn't have clk property, then info->clk may have unpredicated value and cause call trace. So use kzalloc to make sure it is NULL initialized. Signed-off-by: Jingchang Lu <jingchang.lu@freescale.com> Acked-by: Arnd Bergmann <arnd@arndb.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/of_serial.c')
-rw-r--r--drivers/tty/serial/of_serial.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
index 8bc2563335ae..56982da4a9e9 100644
--- a/drivers/tty/serial/of_serial.c
+++ b/drivers/tty/serial/of_serial.c
@@ -158,7 +158,7 @@ static int of_platform_serial_probe(struct platform_device *ofdev)
if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL))
return -EBUSY;
- info = kmalloc(sizeof(*info), GFP_KERNEL);
+ info = kzalloc(sizeof(*info), GFP_KERNEL);
if (info == NULL)
return -ENOMEM;