Linux USB
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Carlos Manuel Santos <cmmpsantos@gmail.com>,
	Samuel Ortiz <sameo@linux.intel.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	linux-usb@vger.kernel.org, linux-wireless@vger.kernel.org,
	kbuild-all@01.org
Subject: ACS ACR122U not working: pn533_usb 1-1:1.0: NFC: fix memdup.cocci warnings
Date: Fri, 18 May 2018 08:13:29 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1805180811210.2323@hadrien> (raw)

From: kbuild test robot <fengguang.wu@intel.com>

 Use kmemdup rather than duplicating its implementation

Generated by: scripts/coccinelle/api/memdup.cocci

Fixes: fe1c559e1567 ("ACS ACR122U not working: pn533_usb 1-1:1.0: NFC: Couldn't poweron...")
CC: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
---

url:
https://github.com/0day-ci/linux/commits/Greg-KH/NFC-pn533-don-t-send-USB-data-off-of-the-stack/20180518-100416
:::::: branch date: 54 minutes ago
:::::: commit date: 54 minutes ago

 usb.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--- a/drivers/nfc/pn533/usb.c
+++ b/drivers/nfc/pn533/usb.c
@@ -153,10 +153,9 @@ static int pn533_usb_send_ack(struct pn5
 	char *buffer;
 	int rc;

-	buffer = kmalloc(sizeof(ack), GFP_KERNEL);
+	buffer = kmemdup(ack, sizeof(ack), GFP_KERNEL);
 	if (!buffer)
 		return -ENOMEM;
-	memcpy(buffer, ack, sizeof(ack));

 	phy->out_urb->transfer_buffer = (u8 *)ack;
 	phy->out_urb->transfer_buffer_length = sizeof(ack);
@@ -390,10 +389,9 @@ static int pn533_acr122_poweron_rdr(stru

 	dev_dbg(&phy->udev->dev, "%s\n", __func__);

-	buffer = kmalloc(sizeof(cmd), GFP_KERNEL);
+	buffer = kmemdup(cmd, sizeof(cmd), GFP_KERNEL);
 	if (!buffer)
 		return -ENOMEM;
-	memcpy(buffer, cmd, sizeof(cmd));

 	init_completion(&arg.done);
 	cntx = phy->in_urb->context;  /* backup context */

                 reply	other threads:[~2018-05-18  6:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=alpine.DEB.2.20.1805180811210.2323@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=cmmpsantos@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kbuild-all@01.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=sameo@linux.intel.com \
    --cc=stephen@networkplumber.org \
    /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