Re: [PATCH] brcmfmac: use kmemdup

From: Arend Van Spriel
Date: Fri May 20 2016 - 03:53:55 EST


On 19-5-2016 15:59, Muhammad Falak R Wani wrote:
> Use kmemdup when some other buffer is immediately copied into allocated
> region. It replaces call to allocation followed by memcpy, by a single
> call to kmemdup.

Acked-by: Arend van Spriel <arend.vanspriel@xxxxxxxxxxxx>
> Signed-off-by: Muhammad Falak R Wani <falakreyaz@xxxxxxxxx>
> ---
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
> index d0631b6..705adaa 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
> @@ -6699,11 +6699,10 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
> return NULL;
> }
>
> - ops = kzalloc(sizeof(*ops), GFP_KERNEL);
> + ops = kmemdup(&brcmf_cfg80211_ops, sizeof(*ops), GFP_KERNEL);
> if (!ops)
> return NULL;
>
> - memcpy(ops, &brcmf_cfg80211_ops, sizeof(*ops));
> ifp = netdev_priv(ndev);
> #ifdef CONFIG_PM
> if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_GTK))
>