All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fs: omfs: use kmemdup() rather than kmalloc+memcpy
@ 2020-08-24 21:17 Alex Dewar
  2020-09-09 19:04 ` Alex Dewar
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Dewar @ 2020-08-24 21:17 UTC (permalink / raw)
  To: Bob Copeland, linux-karma-devel, linux-kernel; +Cc: Alex Dewar

Issue identified with Coccinelle.

Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
---
 fs/omfs/inode.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c
index b76ec6b88ded..8867cefa79cf 100644
--- a/fs/omfs/inode.c
+++ b/fs/omfs/inode.c
@@ -363,12 +363,11 @@ static int omfs_get_imap(struct super_block *sb)
 		bh = sb_bread(sb, block++);
 		if (!bh)
 			goto nomem_free;
-		*ptr = kmalloc(sb->s_blocksize, GFP_KERNEL);
+		*ptr = kmemdup(bh->b_data, sb->s_blocksize, GFP_KERNEL);
 		if (!*ptr) {
 			brelse(bh);
 			goto nomem_free;
 		}
-		memcpy(*ptr, bh->b_data, sb->s_blocksize);
 		if (count < sb->s_blocksize)
 			memset((void *)*ptr + count, 0xff,
 				sb->s_blocksize - count);
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-14 13:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-24 21:17 [PATCH] fs: omfs: use kmemdup() rather than kmalloc+memcpy Alex Dewar
2020-09-09 19:04 ` Alex Dewar
2020-09-14 13:03   ` Bob Copeland

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.