Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07D31C33C9E for ; Wed, 8 Jan 2020 11:21:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D8BB4206F0 for ; Wed, 8 Jan 2020 11:21:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726594AbgAHLVK (ORCPT ); Wed, 8 Jan 2020 06:21:10 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:8243 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726107AbgAHLVK (ORCPT ); Wed, 8 Jan 2020 06:21:10 -0500 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id E1441D60C144FDC3B04F; Wed, 8 Jan 2020 19:21:07 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.439.0; Wed, 8 Jan 2020 19:20:59 +0800 From: Chen Zhou To: CC: , , Subject: [PATCH] fs: omfs: use kmemdup Date: Wed, 8 Jan 2020 19:16:48 +0800 Message-ID: <20200108111648.36050-1-chenzhou10@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix memdup.cocci warnings: ./fs/omfs/inode.c:366:9-16: WARNING opportunity for kmemdup Use kmemdup rather than duplicating its implementation. Signed-off-by: Chen Zhou --- fs/omfs/inode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c index b76ec6b..8867cef 100644 --- a/fs/omfs/inode.c +++ b/fs/omfs/inode.c @@ -363,12 +363,11 @@ static int omfs_get_imap(struct super_block *sb) bh = sb_bread(sb, block++); if (!bh) goto nomem_free; - *ptr = kmalloc(sb->s_blocksize, GFP_KERNEL); + *ptr = kmemdup(bh->b_data, sb->s_blocksize, GFP_KERNEL); if (!*ptr) { brelse(bh); goto nomem_free; } - memcpy(*ptr, bh->b_data, sb->s_blocksize); if (count < sb->s_blocksize) memset((void *)*ptr + count, 0xff, sb->s_blocksize - count); -- 2.7.4