[no subject]

From: Huang Shijie
Date: Sun Aug 08 2010 - 08:39:07 EST


The original code did not free the old map. This patch fixes it.

tj: use @old as memcpy source instead of @chunk->map, and indentation
and description update

Signed-off-by: Huang Shijie <shijie8@xxxxxxxxx>
Signed-off-by: Tejun Heo <tj@xxxxxxxxxx>
---
Patch applied to percpu#for-linus w/ some updates. Thanks a lot for
catching this.

mm/percpu.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/mm/percpu.c b/mm/percpu.c
index e61dc2c..a1830d8 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -393,7 +393,9 @@ static int pcpu_extend_area_map(struct pcpu_chunk *chunk, int new_alloc)
goto out_unlock;

old_size = chunk->map_alloc * sizeof(chunk->map[0]);
- memcpy(new, chunk->map, old_size);
+ old = chunk->map;
+
+ memcpy(new, old, old_size);

chunk->map_alloc = new_alloc;
chunk->map = new;
--
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/