summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-02-24 03:57:20 +0100
committerTejun Heo <tj@kernel.org>2009-02-24 03:57:20 +0100
commitcb83b42e23bd6c4bf91793a320fbe83787c13596 (patch)
tree7f2b83bccf1be9548f84fa74867043aaad0a3e45 /mm
parentpercpu: clean up size usage (diff)
downloadlinux-cb83b42e23bd6c4bf91793a320fbe83787c13596.tar.xz
linux-cb83b42e23bd6c4bf91793a320fbe83787c13596.zip
percpu: fix pcpu_chunk_struct_size
Impact: fix short allocation leading to memory corruption While dropping rvalue wrapping macros around global parameters, pcpu_chunk_struct_size was set incorrectly resulting in shorter page pointer array. Fix it. Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/percpu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/percpu.c b/mm/percpu.c
index 997724c2ea24..ed92caa2aa3b 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -850,7 +850,7 @@ size_t __init pcpu_setup_static(pcpu_populate_pte_fn_t populate_pte_fn,
pcpu_chunk_size = num_possible_cpus() * pcpu_unit_size;
pcpu_nr_slots = pcpu_size_to_slot(pcpu_unit_size) + 1;
pcpu_chunk_struct_size = sizeof(struct pcpu_chunk)
- + (1 << pcpu_unit_pages_shift) * sizeof(struct page *);
+ + num_possible_cpus() * pcpu_unit_pages * sizeof(struct page *);
/* allocate chunk slots */
pcpu_slot = alloc_bootmem(pcpu_nr_slots * sizeof(pcpu_slot[0]));