351-0006-brcmfmac-use-kmemdup.patch 968 B

12345678910111213141516171819202122232425262728
  1. From: Muhammad Falak R Wani <falakreyaz@gmail.com>
  2. Date: Thu, 19 May 2016 19:29:03 +0530
  3. Subject: [PATCH] brcmfmac: use kmemdup
  4. Use kmemdup when some other buffer is immediately copied into allocated
  5. region. It replaces call to allocation followed by memcpy, by a single
  6. call to kmemdup.
  7. Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
  8. Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  9. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10. ---
  11. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  12. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  13. @@ -6730,11 +6730,10 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  14. return NULL;
  15. }
  16. - ops = kzalloc(sizeof(*ops), GFP_KERNEL);
  17. + ops = kmemdup(&brcmf_cfg80211_ops, sizeof(*ops), GFP_KERNEL);
  18. if (!ops)
  19. return NULL;
  20. - memcpy(ops, &brcmf_cfg80211_ops, sizeof(*ops));
  21. ifp = netdev_priv(ndev);
  22. #ifdef CONFIG_PM
  23. if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_GTK))