From patchwork Fri Sep 14 02:33:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yue Haibing X-Patchwork-Id: 10600261 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AC71F933 for ; Fri, 14 Sep 2018 02:24:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1C602A6BD for ; Fri, 14 Sep 2018 02:24:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C52422A6FB; Fri, 14 Sep 2018 02:24:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 229BD2A6BD for ; Fri, 14 Sep 2018 02:24:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726920AbeINHg2 (ORCPT ); Fri, 14 Sep 2018 03:36:28 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:12117 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725953AbeINHg2 (ORCPT ); Fri, 14 Sep 2018 03:36:28 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id E76D52E24746F; Fri, 14 Sep 2018 10:24:11 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.399.0; Fri, 14 Sep 2018 10:24:03 +0800 From: YueHaibing To: Sathya Prakash , Chaitra P B , Suganath Prabu Subramani CC: YueHaibing , , , Subject: [PATCH -next] scsi: mptfusion: Use kmemdup rather than duplicating its implementation in mpt_remove_dead_ioc_func Date: Fri, 14 Sep 2018 02:33:58 +0000 Message-ID: <1536892438-129520-1-git-send-email-yuehaibing@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use kmemdup rather than duplicating its implementation Signed-off-by: YueHaibing --- 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 dc1e43a..a32d3d0 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c @@ -6001,13 +6001,12 @@ static int mpt_remove_dead_ioc_func(void *arg) 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);