netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cfg80211: Use kmemdup in cfg80211_gen_new_ie()
@ 2019-02-25 12:38 YueHaibing
  0 siblings, 0 replies; only message in thread
From: YueHaibing @ 2019-02-25 12:38 UTC (permalink / raw)
  To: Johannes Berg; +Cc: YueHaibing, linux-wireless, netdev, kernel-janitors

Use kmemdup rather than duplicating its implementation

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 net/wireless/scan.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 287518c6caa4..04d888628f29 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -190,10 +190,9 @@ static size_t cfg80211_gen_new_ie(const u8 *ie, size_t ielen,
 	/* copy subelement as we need to change its content to
 	 * mark an ie after it is processed.
 	 */
-	sub_copy = kmalloc(subie_len, gfp);
+	sub_copy = kmemdup(subelement, subie_len, gfp);
 	if (!sub_copy)
 		return 0;
-	memcpy(sub_copy, subelement, subie_len);
 
 	pos = &new_ie[0];




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-02-25 12:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-25 12:38 [PATCH] cfg80211: Use kmemdup in cfg80211_gen_new_ie() YueHaibing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).