Skip to content

Commit 7e12e67

Browse files
Jingchang Lugregkh
authored andcommitted
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 <[email protected]> Acked-by: Arnd Bergmann <[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 9e326f7 commit 7e12e67

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/tty/serial/of_serial.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ static int of_platform_serial_probe(struct platform_device *ofdev)
158158
if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL))
159159
return -EBUSY;
160160

161-
info = kmalloc(sizeof(*info), GFP_KERNEL);
161+
info = kzalloc(sizeof(*info), GFP_KERNEL);
162162
if (info == NULL)
163163
return -ENOMEM;
164164

0 commit comments

Comments
 (0)