Skip to content

Commit 01afb21

Browse files
yanburmanLinus Torvalds
authored andcommitted
[PATCH] reiser: replace kmalloc+memset with kzalloc
Replace kmalloc+memset with kzalloc Signed-off-by: Yan Burman <burman.yan@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 9399575 commit 01afb21

3 files changed

Lines changed: 4 additions & 9 deletions

File tree

‎fs/reiserfs/file.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,12 +317,11 @@ static int reiserfs_allocate_blocks_for_region(struct reiserfs_transaction_handl
317317
/* area filled with zeroes, to supply as list of zero blocknumbers
318318
We allocate it outside of loop just in case loop would spin for
319319
several iterations. */
320-
char *zeros = kmalloc(to_paste * UNFM_P_SIZE, GFP_ATOMIC); // We cannot insert more than MAX_ITEM_LEN bytes anyway.
320+
char *zeros = kzalloc(to_paste * UNFM_P_SIZE, GFP_ATOMIC); // We cannot insert more than MAX_ITEM_LEN bytes anyway.
321321
if (!zeros) {
322322
res = -ENOMEM;
323323
goto error_exit_free_blocks;
324324
}
325-
memset(zeros, 0, to_paste * UNFM_P_SIZE);
326325
do {
327326
to_paste =
328327
min_t(__u64, hole_size,

‎fs/reiserfs/inode.c‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -929,15 +929,12 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
929929
if (blocks_needed == 1) {
930930
un = &unf_single;
931931
} else {
932-
un = kmalloc(min(blocks_needed, max_to_insert) * UNFM_P_SIZE, GFP_ATOMIC); // We need to avoid scheduling.
932+
un = kzalloc(min(blocks_needed, max_to_insert) * UNFM_P_SIZE, GFP_ATOMIC); // We need to avoid scheduling.
933933
if (!un) {
934934
un = &unf_single;
935935
blocks_needed = 1;
936936
max_to_insert = 0;
937-
} else
938-
memset(un, 0,
939-
UNFM_P_SIZE * min(blocks_needed,
940-
max_to_insert));
937+
}
941938
}
942939
if (blocks_needed <= max_to_insert) {
943940
/* we are going to add target block to the file. Use allocated

‎fs/reiserfs/super.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,13 +1549,12 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
15491549
struct reiserfs_sb_info *sbi;
15501550
int errval = -EINVAL;
15511551

1552-
sbi = kmalloc(sizeof(struct reiserfs_sb_info), GFP_KERNEL);
1552+
sbi = kzalloc(sizeof(struct reiserfs_sb_info), GFP_KERNEL);
15531553
if (!sbi) {
15541554
errval = -ENOMEM;
15551555
goto error;
15561556
}
15571557
s->s_fs_info = sbi;
1558-
memset(sbi, 0, sizeof(struct reiserfs_sb_info));
15591558
/* Set default values for options: non-aggressive tails, RO on errors */
15601559
REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_SMALLTAIL);
15611560
REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_ERROR_RO);

0 commit comments

Comments
 (0)