linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chaehyun Lim <chaehyun.lim@gmail.com>
To: gregkh@linuxfoundation.org
Cc: johnny.kim@atmel.com, austin.shin@atmel.com,
	chris.park@atmel.com, tony.cho@atmel.com, glen.lee@atmel.com,
	leo.kim@atmel.com, linux-wireless@vger.kernel.org,
	devel@driverdev.osuosl.org, Chaehyun Lim <chaehyun.lim@gmail.com>
Subject: [PATCH 3/7] staging: wilc1000: handle_set_mac_address: use kmemdup
Date: Tue, 16 Feb 2016 17:39:51 +0900	[thread overview]
Message-ID: <1455611995-28773-3-git-send-email-chaehyun.lim@gmail.com> (raw)
In-Reply-To: <1455611995-28773-1-git-send-email-chaehyun.lim@gmail.com>

This patch replaces kmalloc followed by memcpy with kmemdup.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
---
 drivers/staging/wilc1000/host_interface.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 4d50b38..65d2393 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -429,13 +429,11 @@ static s32 handle_set_mac_address(struct wilc_vif *vif,
 {
 	s32 result = 0;
 	struct wid wid;
-	u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL);
 
+	u8 *mac_buf = kmemdup(set_mac_addr->mac_addr, ETH_ALEN, GFP_KERNEL);
 	if (!mac_buf)
 		return -ENOMEM;
 
-	memcpy(mac_buf, set_mac_addr->mac_addr, ETH_ALEN);
-
 	wid.id = (u16)WID_MAC_ADDR;
 	wid.type = WID_STR;
 	wid.val = mac_buf;
-- 
2.7.1


  parent reply	other threads:[~2016-02-16  8:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-16  8:39 [PATCH 1/7] staging: wilc1000: handle_set_mac_address: remove debug message of kmalloc failure Chaehyun Lim
2016-02-16  8:39 ` [PATCH 2/7] staging: wilc1000: handle_set_mac_address: fix kmalloc return error code Chaehyun Lim
2016-02-16  8:39 ` Chaehyun Lim [this message]
2016-02-16  8:39 ` [PATCH 4/7] staging: wilc1000: handle_set_mac_address: change return type to void Chaehyun Lim
2016-02-16  8:39 ` [PATCH 5/7] staging: wilc1000: handle_set_mac_address: change data type of result Chaehyun Lim
2016-02-16  8:39 ` [PATCH 6/7] staging: wilc1000: handle_set_mac_address: rename result Chaehyun Lim
2016-02-16  8:39 ` [PATCH 7/7] staging: wilc1000: handle_set_mac_address: use netdev_err Chaehyun Lim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1455611995-28773-3-git-send-email-chaehyun.lim@gmail.com \
    --to=chaehyun.lim@gmail.com \
    --cc=austin.shin@atmel.com \
    --cc=chris.park@atmel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=glen.lee@atmel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=johnny.kim@atmel.com \
    --cc=leo.kim@atmel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=tony.cho@atmel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).