Commit 7e12e675 authored by Jingchang Lu's avatar Jingchang Lu Committed by Greg Kroah-Hartman

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: default avatarJingchang Lu <jingchang.lu@freescale.com>
Acked-by: Arnd Bergmann <arnd@arndb.de
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9e326f78
...@@ -158,7 +158,7 @@ static int of_platform_serial_probe(struct platform_device *ofdev) ...@@ -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)) if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL))
return -EBUSY; return -EBUSY;
info = kmalloc(sizeof(*info), GFP_KERNEL); info = kzalloc(sizeof(*info), GFP_KERNEL);
if (info == NULL) if (info == NULL)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment