From patchwork Fri May 18 06:13:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 10408243 X-Patchwork-Delegate: sameo@linux.intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 34CA060230 for ; Fri, 18 May 2018 06:13:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 188D828821 for ; Fri, 18 May 2018 06:13:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D0AA28866; Fri, 18 May 2018 06:13:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2717B28821 for ; Fri, 18 May 2018 06:13:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751589AbeERGNd (ORCPT ); Fri, 18 May 2018 02:13:33 -0400 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 X-IronPort-AV: E=Sophos;i="5.49,413,1520895600"; d="scan'208";a="327400357" Received: from 85-171-61-52.rev.numericable.fr (HELO [192.168.0.15]) ([85.171.61.52]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 May 2018 08:13:30 +0200 Date: Fri, 18 May 2018 08:13:29 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien 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: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 */