LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] module: use krealloc
@ 2007-02-23 7:41 Pekka J Enberg
2007-02-25 21:41 ` Rusty Russell
0 siblings, 1 reply; 2+ messages in thread
From: Pekka J Enberg @ 2007-02-23 7:41 UTC (permalink / raw)
To: akpm; +Cc: rusty, linux-kernel
From: Pekka Enberg <penberg@cs.helsinki.fi>
This converts an open-coded krealloc() to use the shiny new API.
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
kernel/module.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: uml-2.6/kernel/module.c
===================================================================
--- uml-2.6.orig/kernel/module.c 2007-02-23 09:24:14.000000000 +0200
+++ uml-2.6/kernel/module.c 2007-02-23 09:34:43.000000000 +0200
@@ -308,14 +308,14 @@
{
/* Reallocation required? */
if (pcpu_num_used + 1 > pcpu_num_allocated) {
- int *new = kmalloc(sizeof(new[0]) * pcpu_num_allocated*2,
- GFP_KERNEL);
+ int *new;
+
+ new = krealloc(pcpu_size, sizeof(new[0])*pcpu_num_allocated*2,
+ GFP_KERNEL);
if (!new)
return 0;
- memcpy(new, pcpu_size, sizeof(new[0])*pcpu_num_allocated);
pcpu_num_allocated *= 2;
- kfree(pcpu_size);
pcpu_size = new;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] module: use krealloc
2007-02-23 7:41 [PATCH] module: use krealloc Pekka J Enberg
@ 2007-02-25 21:41 ` Rusty Russell
0 siblings, 0 replies; 2+ messages in thread
From: Rusty Russell @ 2007-02-25 21:41 UTC (permalink / raw)
To: Pekka J Enberg; +Cc: akpm, linux-kernel
On Fri, 2007-02-23 at 09:41 +0200, Pekka J Enberg wrote:
> From: Pekka Enberg <penberg@cs.helsinki.fi>
>
> This converts an open-coded krealloc() to use the shiny new API.
OK, why not.
Thanks!
Rusty.
From: Pekka Enberg <penberg@cs.helsinki.fi>
This converts an open-coded krealloc() to use the shiny new API.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
kernel/module.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: uml-2.6/kernel/module.c
===================================================================
--- uml-2.6.orig/kernel/module.c 2007-02-23 09:24:14.000000000 +0200
+++ uml-2.6/kernel/module.c 2007-02-23 09:34:43.000000000 +0200
@@ -308,14 +308,14 @@
{
/* Reallocation required? */
if (pcpu_num_used + 1 > pcpu_num_allocated) {
- int *new = kmalloc(sizeof(new[0]) * pcpu_num_allocated*2,
- GFP_KERNEL);
+ int *new;
+
+ new = krealloc(pcpu_size, sizeof(new[0])*pcpu_num_allocated*2,
+ GFP_KERNEL);
if (!new)
return 0;
- memcpy(new, pcpu_size, sizeof(new[0])*pcpu_num_allocated);
pcpu_num_allocated *= 2;
- kfree(pcpu_size);
pcpu_size = new;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-02-25 21:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-23 7:41 [PATCH] module: use krealloc Pekka J Enberg
2007-02-25 21:41 ` Rusty Russell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).