From: Cristina Moraru Date: Wed, 21 Oct 2015 17:00:49 +0000 (+0300) Subject: staging: rtl8712: Replace kmalloc with kmalloc_array X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ada40ba4e5b5f6a668a4d684e12a8b097fbafee3;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git staging: rtl8712: Replace kmalloc with kmalloc_array Replace kmalloc with specialized function kmalloc_array when the size is a multiplication of: number_of_elements * size_of_element Signed-off-by: Cristina Moraru Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c index b22dbd5311e7..a4a002b55128 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.c +++ b/drivers/staging/rtl8712/rtl871x_mlme.c @@ -62,8 +62,8 @@ 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 = kmalloc_array(MAX_BSS_CNT, sizeof(struct wlan_network), + GFP_ATOMIC); if (pbuf == NULL) return _FAIL; pmlmepriv->free_bss_buf = pbuf;