Skip to content

Commit

Permalink
percpu: fix pcpu_chunk_struct_size
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tejun Heo committed Feb 24, 2009
1 parent cae3aeb commit cb83b42
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/percpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]));
Expand Down

0 comments on commit cb83b42

Please sign in to comment.