diff options
author | Alexandru Gheorghiu <gheorghiuandru@gmail.com> | 2013-03-28 02:24:53 +0200 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-03-31 09:12:18 +0900 |
commit | 79b5793be44d97c0a0e905c221858af08e5ebd85 (patch) | |
tree | 055039157ea7aee50eaed019d4be820335c7e5f7 /fs/f2fs/node.c | |
parent | 953a3e27e10fc6acb480801ea47197d0270d735e (diff) | |
download | linux-79b5793be44d97c0a0e905c221858af08e5ebd85.tar.bz2 |
f2fs: use kmemdup
Use kmemdup instead of kzalloc and memcpy.
Signed-off-by: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
Acked-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/node.c')
-rw-r--r-- | fs/f2fs/node.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 0177f9434c25..10cbee9dc3d1 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1666,19 +1666,17 @@ static int init_node_manager(struct f2fs_sb_info *sbi) spin_lock_init(&nm_i->free_nid_list_lock); rwlock_init(&nm_i->nat_tree_lock); - nm_i->bitmap_size = __bitmap_size(sbi, NAT_BITMAP); nm_i->init_scan_nid = le32_to_cpu(sbi->ckpt->next_free_nid); nm_i->next_scan_nid = le32_to_cpu(sbi->ckpt->next_free_nid); - - nm_i->nat_bitmap = kzalloc(nm_i->bitmap_size, GFP_KERNEL); - if (!nm_i->nat_bitmap) - return -ENOMEM; + nm_i->bitmap_size = __bitmap_size(sbi, NAT_BITMAP); version_bitmap = __bitmap_ptr(sbi, NAT_BITMAP); if (!version_bitmap) return -EFAULT; - /* copy version bitmap */ - memcpy(nm_i->nat_bitmap, version_bitmap, nm_i->bitmap_size); + nm_i->nat_bitmap = kmemdup(version_bitmap, nm_i->bitmap_size, + GFP_KERNEL); + if (!nm_i->nat_bitmap) + return -ENOMEM; return 0; } |