summaryrefslogtreecommitdiffstats
path: root/fs/ubifs/lpt.c
diff options
context:
space:
mode:
authorAndrzej Hajda <a.hajda@samsung.com>2015-08-07 03:59:31 -0400
committerRichard Weinberger <richard@nod.at>2015-10-03 14:03:14 -0400
commitbbc8a0044fb27da5fadb7efbfb472aed00c58e72 (patch)
tree65097afa4e508ec629c26bdf3302cb9d510220e0 /fs/ubifs/lpt.c
parent9ffecb10283508260936b96022d4ee43a7798b4c (diff)
UBIFS: use kmemdup rather than duplicating its implementation
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 <a.hajda@samsung.com> Reviewed-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'fs/ubifs/lpt.c')
-rw-r--r--fs/ubifs/lpt.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c
index dc9f27e9d61b..9a517109da0f 100644
--- a/fs/ubifs/lpt.c
+++ b/fs/ubifs/lpt.c
@@ -1498,11 +1498,10 @@ static struct ubifs_nnode *dirty_cow_nnode(struct ubifs_info *c,
1498 } 1498 }
1499 1499
1500 /* nnode is being committed, so copy it */ 1500 /* nnode is being committed, so copy it */
1501 n = kmalloc(sizeof(struct ubifs_nnode), GFP_NOFS); 1501 n = kmemdup(nnode, sizeof(struct ubifs_nnode), GFP_NOFS);
1502 if (unlikely(!n)) 1502 if (unlikely(!n))
1503 return ERR_PTR(-ENOMEM); 1503 return ERR_PTR(-ENOMEM);
1504 1504
1505 memcpy(n, nnode, sizeof(struct ubifs_nnode));
1506 n->cnext = NULL; 1505 n->cnext = NULL;
1507 __set_bit(DIRTY_CNODE, &n->flags); 1506 __set_bit(DIRTY_CNODE, &n->flags);
1508 __clear_bit(COW_CNODE, &n->flags); 1507 __clear_bit(COW_CNODE, &n->flags);
@@ -1549,11 +1548,10 @@ static struct ubifs_pnode *dirty_cow_pnode(struct ubifs_info *c,
1549 } 1548 }
1550 1549
1551 /* pnode is being committed, so copy it */ 1550 /* pnode is being committed, so copy it */
1552 p = kmalloc(sizeof(struct ubifs_pnode), GFP_NOFS); 1551 p = kmemdup(pnode, sizeof(struct ubifs_pnode), GFP_NOFS);
1553 if (unlikely(!p)) 1552 if (unlikely(!p))
1554 return ERR_PTR(-ENOMEM); 1553 return ERR_PTR(-ENOMEM);
1555 1554
1556 memcpy(p, pnode, sizeof(struct ubifs_pnode));
1557 p->cnext = NULL; 1555 p->cnext = NULL;
1558 __set_bit(DIRTY_CNODE, &p->flags); 1556 __set_bit(DIRTY_CNODE, &p->flags);
1559 __clear_bit(COW_CNODE, &p->flags); 1557 __clear_bit(COW_CNODE, &p->flags);