[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAOiHx=k7=ExZgY=RcKE3t0i5xzF3TKjDfRBkvQZK5B=XMtbkOg@mail.gmail.com>
Date: Sat, 14 Jun 2014 16:08:27 +0200
From: Jonas Gorski <jogo@...nwrt.org>
To: Vitaly Osipov <vitaly.osipov@...il.com>
Cc: Larry Finger <Larry.Finger@...inger.net>,
Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
devel@...verdev.osuosl.org,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] staging: rtl8712: use kcalloc instead of kmalloc(x*y, ...)
On Sat, Jun 14, 2014 at 1:48 PM, Vitaly Osipov <vitaly.osipov@...il.com> wrote:
> Replaced kmalloc(x*y, ...) with kcalloc(x,y,...)
>
> Signed-off-by: Vitaly Osipov <vitaly.osipov@...il.com>
> ---
> drivers/staging/rtl8712/rtl871x_mlme.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
> index 26b8f37..8561841 100644
> --- a/drivers/staging/rtl8712/rtl871x_mlme.c
> +++ b/drivers/staging/rtl8712/rtl871x_mlme.c
> @@ -62,8 +62,7 @@ static sint _init_mlme_priv(struct _adapter *padapter)
> _init_queue(&(pmlmepriv->scanned_queue));
> set_scanned_network_val(pmlmepriv, 0);
> memset(&pmlmepriv->assoc_ssid, 0, sizeof(struct ndis_802_11_ssid));
> - pbuf = kmalloc(MAX_BSS_CNT * (sizeof(struct wlan_network)),
> - GFP_ATOMIC);
> + pbuf = kcalloc(MAX_BSS_CNT, sizeof(struct wlan_network), GFP_ATOMIC);
kcalloc() additionally zeroes the memory, so this is a change in
behaviour. A better replacement would be kmalloc_array().
Jonas
--
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