From patchwork Fri Aug 7 07:59:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 6966321 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C5D229F358 for ; Fri, 7 Aug 2015 08:12:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0FA3020641 for ; Fri, 7 Aug 2015 08:12:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 20E3B203FB for ; Fri, 7 Aug 2015 08:12:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751657AbbHGILs (ORCPT ); Fri, 7 Aug 2015 04:11:48 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:25476 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422632AbbHGIAk (ORCPT ); Fri, 7 Aug 2015 04:00:40 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NSP00KC0CX23J40@mailout4.w1.samsung.com>; Fri, 07 Aug 2015 09:00:38 +0100 (BST) X-AuditID: cbfec7f5-f794b6d000001495-0d-55c465a62f5f Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 9E.09.05269.6A564C55; Fri, 7 Aug 2015 09:00:38 +0100 (BST) Received: from AMDC1061.digital.local ([106.116.147.88]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NSP0013BCW67E10@eusync2.samsung.com>; Fri, 07 Aug 2015 09:00:38 +0100 (BST) From: Andrzej Hajda To: Adaptec OEM Raid Solutions , "James E.J. Bottomley" Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org Subject: [PATCH 17/31] scsi/aacraid: use kmemdup rather than duplicating its implementation Date: Fri, 07 Aug 2015 09:59:23 +0200 Message-id: <1438934377-4922-18-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1438934377-4922-1-git-send-email-a.hajda@samsung.com> References: <1438934377-4922-1-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnluLIzCtJLcpLzFFi42I5/e/4Fd1lqUdCDa7c1rO4te4cq8Wnd9tY LTbOWM9q8X/9bRaLy7vmsFl0X9/BZrH2yF12B3aPdzvmsnkc/vGD2aNvyypGj8+b5AJYorhs UlJzMstSi/TtErgyXk/uYi04zFlx/uQfxgbGM+xdjJwcEgImEgv/f2SCsMUkLtxbz9bFyMUh JLCUUaJ96192CKeJSWJd30oWkCo2AU2Jv5tvAlVxcIgIpEhMuBoIUsMscIpR4mx7NxtIjbBA rMT99a/ANrAIqEocu3+QEcTmFXCWmHv1DSPENjmJk8cms4LYnEDxld0zwWwhASeJN30XmCcw 8i5gZFjFKJpamlxQnJSea6RXnJhbXJqXrpecn7uJERJMX3cwLj1mdYhRgINRiYc34d/hUCHW xLLiytxDjBIczEoivA/1gUK8KYmVValF+fFFpTmpxYcYpTlYlMR5Z+56HyIkkJ5YkpqdmlqQ WgSTZeLglGpgVFq/kXmznlwJW2kHd1TtxP7dqvwHLjyK/Gm3sLilWl1eXzab1SxZrLUieW5h y9+JRS/vrLmft/J6k0uP2ewpqbab06edOMud/kozRYBluarXLtsy78NzVv+W+Lmm9Wjs4jv/ srVVFi5xSP77gkv12jLztWenu6YEPEqrMPJOW6nwJfrG38dSSizFGYmGWsxFxYkAR95ZLyIC AAA= Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The patch was generated using fixed coccinelle semantic patch scripts/coccinelle/api/memdup.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320 Signed-off-by: Andrzej Hajda --- drivers/scsi/aacraid/commctrl.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c index 54195a1..d2ed626 100644 --- a/drivers/scsi/aacraid/commctrl.c +++ b/drivers/scsi/aacraid/commctrl.c @@ -635,15 +635,14 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) } } else { struct user_sgmap* usg; - usg = kmalloc(actual_fibsize - sizeof(struct aac_srb) - + sizeof(struct sgmap), GFP_KERNEL); + usg = kmemdup(upsg, + actual_fibsize - sizeof(struct aac_srb) + sizeof(struct sgmap), + GFP_KERNEL); if (!usg) { dprintk((KERN_DEBUG"aacraid: Allocation error in Raw SRB command\n")); rcode = -ENOMEM; goto cleanup; } - memcpy (usg, upsg, actual_fibsize - sizeof(struct aac_srb) - + sizeof(struct sgmap)); actual_fibsize = actual_fibsize64; for (i = 0; i < usg->count; i++) {