serial/core: Fix too big allocation for attribute member
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>
This commit is contained in:
Родитель
48479148a2
Коммит
c2b703b807
|
@ -2618,7 +2618,7 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport)
|
||||||
if (uport->attr_group)
|
if (uport->attr_group)
|
||||||
num_groups++;
|
num_groups++;
|
||||||
|
|
||||||
uport->tty_groups = kcalloc(num_groups, sizeof(**uport->tty_groups),
|
uport->tty_groups = kcalloc(num_groups, sizeof(*uport->tty_groups),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!uport->tty_groups) {
|
if (!uport->tty_groups) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче