Skip to content

Commit a7c9df0

Browse files
alexdewarAl Viro
authored andcommitted
fs: omfs: use kmemdup() rather than kmalloc+memcpy
Issue identified with Coccinelle. Signed-off-by: Alex Dewar <alex.dewar90@gmail.com> Acked-by: Bob Copeland <me@bobcopeland.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 6d1349c commit a7c9df0

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

fs/omfs/inode.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,12 +362,11 @@ static int omfs_get_imap(struct super_block *sb)
362362
bh = sb_bread(sb, block++);
363363
if (!bh)
364364
goto nomem_free;
365-
*ptr = kmalloc(sb->s_blocksize, GFP_KERNEL);
365+
*ptr = kmemdup(bh->b_data, sb->s_blocksize, GFP_KERNEL);
366366
if (!*ptr) {
367367
brelse(bh);
368368
goto nomem_free;
369369
}
370-
memcpy(*ptr, bh->b_data, sb->s_blocksize);
371370
if (count < sb->s_blocksize)
372371
memset((void *)*ptr + count, 0xff,
373372
sb->s_blocksize - count);

0 commit comments

Comments
 (0)