Return-path: Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:10604 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751251AbeERGNc (ORCPT ); Fri, 18 May 2018 02:13:32 -0400 Date: Fri, 18 May 2018 08:13:29 +0200 (CEST) From: Julia Lawall To: Greg KH cc: Carlos Manuel Santos , Samuel Ortiz , Stephen Hemminger , linux-usb@vger.kernel.org, linux-wireless@vger.kernel.org, kbuild-all@01.org Subject: [PATCH] ACS ACR122U not working: pn533_usb 1-1:1.0: NFC: fix memdup.cocci warnings Message-ID: (sfid-20180518_081335_979870_58FCD2CF) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-wireless-owner@vger.kernel.org List-ID: From: kbuild test robot 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 Signed-off-by: kbuild test robot Signed-off-by: Julia Lawall --- 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(-) --- 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 */