From: Saiyam Doshi <saiyamdoshi.in@gmail.com>
To: me@bobcopeland.com
Cc: linux-karma-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: [PATCH] omfs: make use of kmemdup
Date: Fri, 13 Sep 2019 22:41:34 +0530 [thread overview]
Message-ID: <20190913171134.GA10301@SD> (raw)
Replace call to kmalloc followed by memcpy with a direct call
to kmemdup to achieve same functionality.
Signed-off-by: Saiyam Doshi <saiyamdoshi.in@gmail.com>
---
fs/omfs/inode.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c
index b76ec6b88ded..788b41096962 100644
--- a/fs/omfs/inode.c
+++ b/fs/omfs/inode.c
@@ -363,12 +363,13 @@ 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.20.1
next reply other threads:[~2019-09-13 17:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-13 17:11 Saiyam Doshi [this message]
2019-09-14 6:24 ` omfs: make use of kmemdup Markus Elfring
2019-09-14 6:24 ` Markus Elfring
2019-09-16 17:13 ` Saiyam Doshi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190913171134.GA10301@SD \
--to=saiyamdoshi.in@gmail.com \
--cc=linux-karma-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=me@bobcopeland.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.