From: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
To: Anton Vorontsov <cbouatmailru@gmail.com>
Cc: Colin Cross <ccross@android.com>,
Kees Cook <keescook@chromium.org>,
Tony Luck <tony.luck@intel.com>,
linux-kernel@vger.kernel.org,
Alexandru Gheorghiu <gheorghiuandru@gmail.com>
Subject: [PATCH] fs: pstore: Replaced calls to kmalloc and memcpy with kmemdup
Date: Sat, 9 Mar 2013 13:57:28 +0200 [thread overview]
Message-ID: <1362830248-7017-1-git-send-email-gheorghiuandru@gmail.com> (raw)
Replaced calls to kmalloc and memcpy with a single call to kmemdup.
This patch was found using coccicheck.
Signed-off-by: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
---
fs/pstore/ram.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 288f068..38babb3 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -156,10 +156,9 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type,
time->tv_nsec = 0;
size = persistent_ram_old_size(prz);
- *buf = kmalloc(size, GFP_KERNEL);
+ *buf = kmemdup(persistent_ram_old(prz), size, GFP_KERNEL);
if (*buf == NULL)
return -ENOMEM;
- memcpy(*buf, persistent_ram_old(prz), size);
return size;
}
--
1.7.9.5
next reply other threads:[~2013-03-10 22:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-09 11:57 Alexandru Gheorghiu [this message]
2013-03-10 23:23 ` Kees Cook
2013-03-19 2:41 ` Anton Vorontsov
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=1362830248-7017-1-git-send-email-gheorghiuandru@gmail.com \
--to=gheorghiuandru@gmail.com \
--cc=cbouatmailru@gmail.com \
--cc=ccross@android.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®