mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2/2] staging: rtl8712: use kcalloc instead of kmalloc(x*y,...)
@ 2014-06-14 11:48 Vitaly Osipov
  2014-06-14 14:08 ` [PATCH 2/2] staging: rtl8712: use kcalloc instead of kmalloc(x*y, ...) Jonas Gorski
  0 siblings, 1 reply; 2+ messages in thread
From: Vitaly Osipov @ 2014-06-14 11:48 UTC (permalink / raw)
  To: Larry Finger, Florian Schilhabel, Andy Shevchenko, devel, linux-kernel

Replaced kmalloc(x*y, ...) with kcalloc(x,y,...)

Signed-off-by: Vitaly Osipov <vitaly.osipov@gmail.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);
 	if (pbuf == NULL)
 		return _FAIL;
 	pmlmepriv->free_bss_buf = pbuf;
-- 
1.9.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2] staging: rtl8712: use kcalloc instead of kmalloc(x*y, ...)
  2014-06-14 11:48 [PATCH 2/2] staging: rtl8712: use kcalloc instead of kmalloc(x*y,...) Vitaly Osipov
@ 2014-06-14 14:08 ` Jonas Gorski
  0 siblings, 0 replies; 2+ messages in thread
From: Jonas Gorski @ 2014-06-14 14:08 UTC (permalink / raw)
  To: Vitaly Osipov
  Cc: Larry Finger, Florian Schilhabel, Andy Shevchenko, devel, linux-kernel

On Sat, Jun 14, 2014 at 1:48 PM, Vitaly Osipov <vitaly.osipov@gmail.com> wrote:
> Replaced kmalloc(x*y, ...) with kcalloc(x,y,...)
>
> Signed-off-by: Vitaly Osipov <vitaly.osipov@gmail.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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-14 14:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-14 11:48 [PATCH 2/2] staging: rtl8712: use kcalloc instead of kmalloc(x*y,...) Vitaly Osipov
2014-06-14 14:08 ` [PATCH 2/2] staging: rtl8712: use kcalloc instead of kmalloc(x*y, ...) Jonas Gorski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®