]> git.karo-electronics.de Git - linux-beck.git/commitdiff
serial/core: Fix too big allocation for attribute member
authorYoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>
Wed, 23 Jul 2014 06:06:22 +0000 (06:06 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 24 Jul 2014 01:56:17 +0000 (18:56 -0700)
Current code allocates too much data for tty_groups member of uart_port struct,
so fix it.

Signed-off-by: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/serial_core.c

index 61529a84c3fc5f612a486049357ad5c5fa0d81a5..8bb19da01639bb51cc2bc88f40cada8f686cc5a2 100644 (file)
@@ -2618,7 +2618,7 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport)
        if (uport->attr_group)
                num_groups++;
 
-       uport->tty_groups = kcalloc(num_groups, sizeof(**uport->tty_groups),
+       uport->tty_groups = kcalloc(num_groups, sizeof(*uport->tty_groups),
                                    GFP_KERNEL);
        if (!uport->tty_groups) {
                ret = -ENOMEM;