Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422789AbbHGIBo (ORCPT ); Fri, 7 Aug 2015 04:01:44 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:28638 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422705AbbHGIAv (ORCPT ); Fri, 7 Aug 2015 04:00:51 -0400 X-AuditID: cbfec7f4-f79c56d0000012ee-af-55c465ac7c00 From: Andrzej Hajda To: Mark Fasheh , Joel Becker Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , linux-kernel@vger.kernel.org, ocfs2-devel@oss.oracle.com Subject: [PATCH 23/31] fs/ocfs2: use kmemdup rather than duplicating its implementation Date: Fri, 07 Aug 2015 09:59:29 +0200 Message-id: <1438934377-4922-24-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1438934377-4922-1-git-send-email-a.hajda@samsung.com> References: <1438934377-4922-1-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprALMWRmVeSWpSXmKPExsVy+t/xK7prUo+EGrTNVrO4te4cq8XGGetZ LU6e+8ZicXnXHDaLtUfuslucOzORzWLXm3PsDuweTy8GeVxY9obNo2/LKkaP9Vuusnh83iQX wBrFZZOSmpNZllqkb5fAlbH61QWmgqU8FSfWhTQwzuLqYuTgkBAwkbi3ILeLkRPIFJO4cG89 WxcjF4eQwFJGiWMvm1hAEkICTUwSMz7qgthsApoSfzffZAOxRQRcJH40fWIBaWAWOMUocerI dUaQhLBApMTcIyeZQWwWAVWJRf297CDLeAWcJTZPF4VYJidx8thkVhCbEyi8snsmK8QuJ4k3 fReYJzDyLmBkWMUomlqaXFCclJ5rqFecmFtcmpeul5yfu4kREk5fdjAuPmZ1iFGAg1GJhzfh 3+FQIdbEsuLK3EOMEhzMSiK8D/WBQrwpiZVVqUX58UWlOanFhxilOViUxHnn7nofIiSQnliS mp2aWpBaBJNl4uCUamBc8SVp3wZmw5jGvQbWkW7xJQ/2+ywwYMz4J/rOS96h55Jd5v+iOfzp gsXiItPLIsSKuXf9ktncx//h+8amZTMUqhNWeE/WOlKgHD6jWDc/dO99uwXnN6yYdUeq9LQR R/rxZVYX+crcFjuXhR3tTHryJm7GrWNRR5P23GLJdnh0wcnvbmn+4hYlluKMREMt5qLiRADP 7sdvIwIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1772 Lines: 51 The patch was generated using fixed coccinelle semantic patch scripts/coccinelle/api/memdup.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320 Signed-off-by: Andrzej Hajda --- fs/ocfs2/localalloc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c index 0a4457f..194d6d6 100644 --- a/fs/ocfs2/localalloc.c +++ b/fs/ocfs2/localalloc.c @@ -434,12 +434,11 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb) bh = osb->local_alloc_bh; alloc = (struct ocfs2_dinode *) bh->b_data; - alloc_copy = kmalloc(bh->b_size, GFP_NOFS); + alloc_copy = kmemdup(alloc, bh->b_size, GFP_NOFS); if (!alloc_copy) { status = -ENOMEM; goto out_commit; } - memcpy(alloc_copy, alloc, bh->b_size); status = ocfs2_journal_access_di(handle, INODE_CACHE(local_alloc_inode), bh, OCFS2_JOURNAL_ACCESS_WRITE); @@ -1285,13 +1284,12 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb, * local alloc shutdown won't try to double free main bitmap * bits. Make a copy so the sync function knows which bits to * free. */ - alloc_copy = kmalloc(osb->local_alloc_bh->b_size, GFP_NOFS); + alloc_copy = kmemdup(alloc, osb->local_alloc_bh->b_size, GFP_NOFS); if (!alloc_copy) { status = -ENOMEM; mlog_errno(status); goto bail; } - memcpy(alloc_copy, alloc, osb->local_alloc_bh->b_size); status = ocfs2_journal_access_di(handle, INODE_CACHE(local_alloc_inode), -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/