Skip to content

Commit

Permalink
module: use krealloc
Browse files Browse the repository at this point in the history
This converts an open-coded krealloc() to use the shiny new API.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Pekka Enberg authored and Linus Torvalds committed May 8, 2007
1 parent fe08a9d commit 6d4f9c5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,14 @@ static int split_block(unsigned int i, unsigned short size)
{
/* 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;
}

Expand Down

0 comments on commit 6d4f9c5

Please sign in to comment.