lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VdZHrXbUytAcXzitH8zzELjimNihG5LfLqX85u4y502SA@mail.gmail.com>
Date:	Wed, 30 Dec 2015 03:37:06 +0200
From:	Andy Shevchenko <andy.shevchenko@...il.com>
To:	Insu Yun <wuninsu@...il.com>
Cc:	akarwar@...vell.com, nishants@...vell.com,
	Kalle Valo <kvalo@...eaurora.org>,
	"open list:TI WILINK WIRELES..." <linux-wireless@...r.kernel.org>,
	netdev <netdev@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	taesoo@...ech.edu, yeongjin.jang@...ech.edu, insu@...ech.edu,
	changwoo@...ech.edu
Subject: Re: [PATCH] mwifiex: correctly handling kzalloc

On Tue, Dec 29, 2015 at 10:17 PM, Insu Yun <wuninsu@...il.com> wrote:

Empty commit message?

> Signed-off-by: Insu Yun <wuninsu@...il.com>
> ---
>  drivers/net/wireless/mwifiex/sdio.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c
> index 78a8474..a8af72d 100644
> --- a/drivers/net/wireless/mwifiex/sdio.c
> +++ b/drivers/net/wireless/mwifiex/sdio.c
> @@ -2053,8 +2053,19 @@ static int mwifiex_init_sdio(struct mwifiex_adapter *adapter)
>         /* Allocate skb pointer buffers */
>         card->mpa_rx.skb_arr = kzalloc((sizeof(void *)) *
>                                        card->mp_agg_pkt_limit, GFP_KERNEL);

Just noticed: Looks like good candidate for kcalloc or kmalloc_array,
whichever is suitable.

> +       if (!card->mpa_rx.skb_arr) {
> +               kfree(card->mp_regs);
> +               return -ENOMEM;
> +       }
> +
>         card->mpa_rx.len_arr = kzalloc(sizeof(*card->mpa_rx.len_arr) *
>                                        card->mp_agg_pkt_limit, GFP_KERNEL);

Ditto.

> +       if (!card->mpa_rx.len_arr) {
> +               kfree(card->mp_regs);
> +               kfree(card->mpa_rx.skb_arr);


> +               return -ENOMEM;
> +       }
> +
>         ret = mwifiex_alloc_sdio_mpa_buffers(adapter,
>                                              card->mp_tx_agg_buf_size,
>                                              card->mp_rx_agg_buf_size);
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



-- 
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ