Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751944AbbHGILt (ORCPT ); Fri, 7 Aug 2015 04:11:49 -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 X-AuditID: cbfec7f5-f794b6d000001495-0d-55c465a62f5f 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1428 Lines: 41 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++) { -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/