* [PATCH] fs: pstore: Replaced calls to kmalloc and memcpy with kmemdup
@ 2013-03-09 11:57 Alexandru Gheorghiu
2013-03-10 23:23 ` Kees Cook
0 siblings, 1 reply; 3+ messages in thread
From: Alexandru Gheorghiu @ 2013-03-09 11:57 UTC (permalink / raw)
To: Anton Vorontsov
Cc: Colin Cross, Kees Cook, Tony Luck, linux-kernel, Alexandru Gheorghiu
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fs: pstore: Replaced calls to kmalloc and memcpy with kmemdup
2013-03-09 11:57 [PATCH] fs: pstore: Replaced calls to kmalloc and memcpy with kmemdup Alexandru Gheorghiu
@ 2013-03-10 23:23 ` Kees Cook
2013-03-19 2:41 ` Anton Vorontsov
0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2013-03-10 23:23 UTC (permalink / raw)
To: Alexandru Gheorghiu; +Cc: Anton Vorontsov, Colin Cross, Tony Luck, LKML
On Sat, Mar 9, 2013 at 3:57 AM, Alexandru Gheorghiu
<gheorghiuandru@gmail.com> wrote:
> 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;
> }
Looks fine to me. Thanks!
Acked-by: Kees Cook <keescook@chromium.org>
-Kees
--
Kees Cook
Chrome OS Security
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fs: pstore: Replaced calls to kmalloc and memcpy with kmemdup
2013-03-10 23:23 ` Kees Cook
@ 2013-03-19 2:41 ` Anton Vorontsov
0 siblings, 0 replies; 3+ messages in thread
From: Anton Vorontsov @ 2013-03-19 2:41 UTC (permalink / raw)
To: Kees Cook; +Cc: Alexandru Gheorghiu, Colin Cross, Tony Luck, LKML
On Sun, Mar 10, 2013 at 04:23:01PM -0700, Kees Cook wrote:
> On Sat, Mar 9, 2013 at 3:57 AM, Alexandru Gheorghiu
> <gheorghiuandru@gmail.com> wrote:
> > 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>
[...]
> Looks fine to me. Thanks!
>
> Acked-by: Kees Cook <keescook@chromium.org>
Applied to linux-pstore.git, thanks a lot!
Anton
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-19 2:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-09 11:57 [PATCH] fs: pstore: Replaced calls to kmalloc and memcpy with kmemdup Alexandru Gheorghiu
2013-03-10 23:23 ` Kees Cook
2013-03-19 2:41 ` Anton Vorontsov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome