Skip to contentSkip to conversation

kzalloc conversion in fs/hfs

PATCH New Eric Sesterhenn 1 participant 2 messages Feb 23, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kzalloc conversion in fs/hfs

hi,

this converts fs/hfs to kzalloc() usage.
compile tested with make allyesconfig

fs/hfs/bnode.c renamed from fs/hfs/bnode.c.orig +1 -2
@@ -249,10 +249,9 @@ static struct hfs_bnode *__hfs_bnode_cre
 	sb = tree->inode->i_sb;
 	size = sizeof(struct hfs_bnode) + tree->pages_per_bnode *
 		sizeof(struct page *);
-	node = kmalloc(size, GFP_KERNEL);
+	node = kzalloc(size, GFP_KERNEL);
 	if (!node)
 		return NULL;
-	memset(node, 0, size);
 	node->tree = tree;
 	node->this = cnid;
 	set_bit(HFS_BNODE_NEW, &node->flags);
fs/hfs/btree.c renamed from fs/hfs/btree.c.orig +1 -2
@@ -21,10 +21,9 @@ struct hfs_btree *hfs_btree_open(struct 
 	struct page *page;
 	unsigned int size;
 
-	tree = kmalloc(sizeof(*tree), GFP_KERNEL);
+	tree = kzalloc(sizeof(*tree), GFP_KERNEL);
 	if (!tree)
 		return NULL;
-	memset(tree, 0, sizeof(*tree));
 
 	init_MUTEX(&tree->tree_lock);
 	spin_lock_init(&tree->hash_lock);
fs/hfs/super.c renamed from fs/hfs/super.c.orig +1 -2
@@ -355,11 +355,10 @@ static int hfs_fill_super(struct super_b
 	struct inode *root_inode;
 	int res;
 
-	sbi = kmalloc(sizeof(struct hfs_sb_info), GFP_KERNEL);
+	sbi = kzalloc(sizeof(struct hfs_sb_info), GFP_KERNEL);
 	if (!sbi)
 		return -ENOMEM;
 	sb->s_fs_info = sbi;
-	memset(sbi, 0, sizeof(struct hfs_sb_info));
 	INIT_HLIST_HEAD(&sbi->rsrc_inodes);
 
 	res = -EINVAL;

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw

PATCH 1/1 kzalloc conversion in fs/hfsplus

hi,

this converts fs/hfsplus to kzalloc() usage.
compile tested with make allyesconfig

fs/hfsplus/bnode.c renamed from fs/hfsplus/bnode.c.orig +1 -2
@@ -409,10 +409,9 @@ static struct hfs_bnode *__hfs_bnode_cre
 	sb = tree->inode->i_sb;
 	size = sizeof(struct hfs_bnode) + tree->pages_per_bnode *
 		sizeof(struct page *);
-	node = kmalloc(size, GFP_KERNEL);
+	node = kzalloc(size, GFP_KERNEL);
 	if (!node)
 		return NULL;
-	memset(node, 0, size);
 	node->tree = tree;
 	node->this = cnid;
 	set_bit(HFS_BNODE_NEW, &node->flags);
fs/hfsplus/btree.c renamed from fs/hfsplus/btree.c.orig +1 -2
@@ -24,10 +24,9 @@ struct hfs_btree *hfs_btree_open(struct 
 	struct page *page;
 	unsigned int size;
 
-	tree = kmalloc(sizeof(*tree), GFP_KERNEL);
+	tree = kzalloc(sizeof(*tree), GFP_KERNEL);
 	if (!tree)
 		return NULL;
-	memset(tree, 0, sizeof(*tree));
 
 	init_MUTEX(&tree->tree_lock);
 	spin_lock_init(&tree->hash_lock);

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors