Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10672642imu; Thu, 6 Dec 2018 05:06:35 -0800 (PST) X-Google-Smtp-Source: AFSGD/UytkD4ONS/9pgmOtaJNdQhcP/WwlE6oFSdMO//BntbNkeVUTVuLDPnSSoTbPKLPJlZvT79 X-Received: by 2002:a63:5122:: with SMTP id f34mr23085100pgb.218.1544101595852; Thu, 06 Dec 2018 05:06:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544101595; cv=none; d=google.com; s=arc-20160816; b=wlPUTfROrQR0pbizD6xkMAN/bMVbsf6mVrLPOX/IHUyjPgyOEAiDvhWubc4hfFhOEd GeorDZf2kJrooOWpJhw8WO38t5HgAoNK6N9lXxooFiJLGxkbNVRErNe4jcu984T+z3Mt NO690iLT6W2IFq4+ZvL+mrI5xi1sj4Vrc8t5zWBX+aJ4+KcHqsss4q6Xn5Aa1FDjLjLd asYkW7V3E6OerZeM2JRZrYaBMBVAMTFK9P5+1ClcNRXb1wr9C+tb+uOD6yUiXw3jhXLt i2lnIlWdEe2++mQrGdulR7iV0t0Yls1KI8vOECJmDPBzjkhbQTF/KCf8hTKibGtLCx0s SELQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=FMPFuEHRpC8SBP2pE+VjtQMkhrn1fyQyFcmqg2nR4PU=; b=qhS5hHvHakDudzRE6F8ujsxW6CFqsU4Y1ZggODpdhMq8Oyozzz/rKkBDM8xrRiD1og JVfm5vA8qYb7/EFdbBl084Gkr6FvGlU/zpdJeaRV5TD5pPf+DH/fUQbcL0q8qGo0N52A TDCqk6GnaMZ7O+nUAp32eu2rsRGATSa4P1prsSTI860mu254lcF/+mjNqgMycySIoi7b rgNLWkF6NGO68kVWYOZ/serklR3bNDYI0VtR3bXd7ddjxWQB8sg+rHYs9GVu/BGuxBVT vJqWHCVplwDR1hPM1xsW3T67UtHaeNQUTIrQmZ+xCcSF9U19nL9C3Nl3CYIoZqMZ/Ik7 xtBA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z136si267219pgz.28.2018.12.06.05.06.12; Thu, 06 Dec 2018 05:06:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729545AbeLFNC4 (ORCPT + 99 others); Thu, 6 Dec 2018 08:02:56 -0500 Received: from mxhk.zte.com.cn ([63.217.80.70]:63606 "EHLO mxhk.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729367AbeLFNCz (ORCPT ); Thu, 6 Dec 2018 08:02:55 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 024FCE376B459117948D; Thu, 6 Dec 2018 21:02:53 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id wB6D2mEx080766; Thu, 6 Dec 2018 21:02:48 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from LIN-A6CB96A0603.zte.intra ([10.90.106.118]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2018120621032063-15152368 ; Thu, 6 Dec 2018 21:03:20 +0800 From: Wen Yang To: Hannes Reinecke , jejb@linux.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, zhong.weidong@zte.com.cn, Wen Yang Subject: [PATCH] scsi: aic7xxx: Use kmemdup instead of duplicating its function Date: Thu, 6 Dec 2018 21:02:18 +0800 Message-Id: <20181206130218.19776-1-wen.yang99@zte.com.cn> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2018-12-06 21:03:20, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-12-06 21:02:36 Content-Transfer-Encoding: quoted-printable X-MAIL: mse01.zte.com.cn wB6D2mEx080766 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org kmemdup has implemented the function that kmalloc() + memcpy(). We prefer to kmemdup rather than code opened implementation. This issue was detected with the help of coccinelle. Signed-off-by: Wen Yang CC: Hannes Reinecke CC: "James E.J. Bottomley" CC: "Martin K. Petersen" CC: linux-scsi@vger.kernel.org CC: linux-kernel@vger.kernel.org --- drivers/scsi/aic7xxx/aic79xx=5Fcore.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/aic7xxx/aic79xx=5Fcore.c b/drivers/scsi/aic7xxx/a= ic79xx=5Fcore.c index 9ee75c9a9aa1..3e72fac6d248 100644 --- a/drivers/scsi/aic7xxx/aic79xx=5Fcore.c +++ b/drivers/scsi/aic7xxx/aic79xx=5Fcore.c @@ -9438,10 +9438,10 @@ ahd=5Floadseq(struct ahd=5Fsoftc *ahd) if (cs=5Fcount !=3D 0) { =20 cs=5Fcount *=3D sizeof(struct cs); - ahd->critical=5Fsections =3D kmalloc(cs=5Fcount, GFP=5FATOMIC); + ahd->critical=5Fsections =3D kmemdup(cs=5Ftable, cs=5Fcount, + GFP=5FATOMIC); if (ahd->critical=5Fsections =3D=3D NULL) panic("ahd=5Floadseq: Could not malloc"); - memcpy(ahd->critical=5Fsections, cs=5Ftable, cs=5Fcount); } ahd=5Foutb(ahd, SEQCTL0, PERRORDIS|FAILDIS|FASTMODE); =20 --=20 2.19.1