From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753047AbaEZPVA (ORCPT ); Mon, 26 May 2014 11:21:00 -0400 Received: from isis.lip6.fr ([132.227.60.2]:57310 "EHLO isis.lip6.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752992AbaEZPU5 (ORCPT ); Mon, 26 May 2014 11:20:57 -0400 X-pt: isis.lip6.fr From: Benoit Taine To: Nagalakshmi Nandigama Cc: benoit.taine@lip6.fr, Sreekanth Reddy , support@lsi.com, DL-MPTFusionLinux@lsi.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 6/18] fusion: Use kmemdup instead of kmalloc + memcpy Date: Mon, 26 May 2014 17:21:15 +0200 Message-Id: <1401117687-28911-7-git-send-email-benoit.taine@lip6.fr> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1401117687-28911-1-git-send-email-benoit.taine@lip6.fr> References: <1401117687-28911-1-git-send-email-benoit.taine@lip6.fr> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (isis.lip6.fr [132.227.60.2]); Mon, 26 May 2014 17:20:41 +0200 (CEST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This issue was reported by coccicheck using the semantic patch at scripts/coccinelle/api/memdup.cocci Signed-off-by: Benoit Taine --- Tested by compilation without errors. drivers/message/fusion/mptbase.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 570b18a..6417a3f 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c @@ -6004,13 +6004,12 @@ mpt_findImVolumes(MPT_ADAPTER *ioc) if (mpt_config(ioc, &cfg) != 0) goto out; - mem = kmalloc(iocpage2sz, GFP_KERNEL); + mem = kmemdup((u8 *)pIoc2, iocpage2sz, GFP_KERNEL); if (!mem) { rc = -ENOMEM; goto out; } - memcpy(mem, (u8 *)pIoc2, iocpage2sz); ioc->raid_data.pIocPg2 = (IOCPage2_t *) mem; mpt_read_ioc_pg_3(ioc);