Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp373729ybm; Wed, 22 May 2019 04:49:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqxLgNqA6fkE1C64Mucjc5PVeV7WW0WW5ufkyNsyMxboyVaKzI8PxwVMEkCAGOXQET+gXakZ X-Received: by 2002:a17:902:2bc9:: with SMTP id l67mr54641156plb.171.1558525798560; Wed, 22 May 2019 04:49:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558525798; cv=none; d=google.com; s=arc-20160816; b=Xud9U7jH6LYNia9XfGrEFOZt9Ly7s41MhGND517GhYU0Q5zYa9qozeHp4vW1/aEpIy V7zIezYRUgNCminJxkEXxjpegrlx80Yubga1p9Ekz9iQRX3apixinzwVpPH7mbqb/FcE 34o4foVOkyLRwQMf2KnCYFG030ucfuqDVkycBdsFjx5OUKzRgbQK5nQVsv8mGbzSCBN8 pVpvFGaz5BhT8Z7lSAoK4R+W2utv9YIbPnJwKp7S0b2HSy2rPJ7uh/FL8XfVWjKFluvN +QVicNXgwtF9I//OLyc6onmpdqAiFpIelvoIyiRsy1JafoCJkeEf43M0qy8pNTuUc0He lYcg== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=3/iNowKh0vi2nSpT+eHNV6uYgtaqcb0FZya0owa5nuo=; b=NxubNKZx1BtDj3SHJxwn9pNQ5I5Toz3WYuwg9GIMNQafBo2QIbQp0MKdhb4Yb2twnV A2yA6yMy/0VunZnFWvysUGuNCM/FbspEEtQ/wNhBn81XU5lqjgTJoj6T/sVH1PNqFL+E C6zxCGPe9L00CCCSDNdDN+3Sav3hM6g/hMU0jf7n2YbICJPskDpqO09kLDFQYTKZ07Gy QA4Zl5/Uvgk1qE9Mr3LkfBwd4zspl+bpOBZJXJcn89+nE/I3WZvaUy6w3SebnAdvD3KC gnrWyu2NgOIDgnFqiXV+5qn0JWQ44bhiedazq+RB6zE931CRS5KwVH5lKQYa4/QvUuyE 5mQw== 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 70si20918355pfz.49.2019.05.22.04.49.42; Wed, 22 May 2019 04:49:58 -0700 (PDT) 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 S1728693AbfEVLsh (ORCPT + 99 others); Wed, 22 May 2019 07:48:37 -0400 Received: from smtprelay0057.hostedemail.com ([216.40.44.57]:45688 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727464AbfEVLsh (ORCPT ); Wed, 22 May 2019 07:48:37 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay01.hostedemail.com (Postfix) with ESMTP id 4038A100E86C0; Wed, 22 May 2019 11:48:36 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::,RULES_HIT:41:355:379:599:968:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1538:1567:1593:1594:1711:1714:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3622:3865:3873:4321:5007:7903:8957:10004:10400:10848:11232:11658:11914:12043:12663:12740:12760:12895:13069:13095:13311:13357:13439:14659:14721:21080:21212:21433:21627:30054:30091,0,RBL:23.242.196.136:@perches.com:.lbl8.mailshell.net-62.14.0.180 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:35,LUA_SUMMARY:none X-HE-Tag: spoon28_6812e54d5f51b X-Filterd-Recvd-Size: 1441 Received: from XPS-9350.home (cpe-23-242-196-136.socal.res.rr.com [23.242.196.136]) (Authenticated sender: joe@perches.com) by omf20.hostedemail.com (Postfix) with ESMTPA; Wed, 22 May 2019 11:48:35 +0000 (UTC) Message-ID: <7e2a727333d1d764ae3c0099e050a0521e87d9d8.camel@perches.com> Subject: Re: [PATCH] message/fusion/mptbase.c: Use kmemdup instead of memcpy and kmalloc From: Joe Perches To: Bharath Vedartham , sathya.prakash@broadcom.com, chaitra.basappa@broadcom.com Cc: MPT-FusionLinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 22 May 2019 04:48:33 -0700 In-Reply-To: <20190522095335.GA3212@bharath12345-Inspiron-5559> References: <20190522095335.GA3212@bharath12345-Inspiron-5559> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.30.1-1build1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2019-05-22 at 15:23 +0530, Bharath Vedartham wrote: > Replace kmalloc + memcpy with kmemdup. > This was reported by coccinelle. [] > diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c [] > @@ -6001,13 +6001,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); You should remove the unnecessary cast here.