diff options
author | Thomas Gleixner <[email protected]> | 2016-12-13 19:32:28 +0100 |
---|---|---|
committer | Thomas Gleixner <[email protected]> | 2016-12-15 11:32:31 +0100 |
commit | 427d77a32365d5f942d335248305a5c237baf63a (patch) | |
tree | bc71ce672cf89239bdd90b15a1a5e39e2123fa10 /net | |
parent | 31dcfec11f827e9a5d8720fe4728f1305894884f (diff) |
x86/smpboot: Prevent false positive out of bounds cpumask access warning
prefill_possible_map() reinitializes the cpu_possible_map by setting the
possible cpu bits and clearing all other bits up to NR_CPUS.
This is technically always correct because cpu_possible_map is statically
allocated and sized NR_CPUS. With CPUMASK_OFFSTACK and DEBUG_PER_CPU_MAPS
enabled the bounds check of cpu masks happens on nr_cpu_ids. nr_cpu_ids is
initialized to NR_CPUS and only limited after the set/clear bit loops have
been executed.
But if the system was booted with "nr_cpus=N" on the command line, where N
is < NR_CPUS then nr_cpu_ids is limited in the parameter parsing function
before prefill_possible_map() is invoked. As a consequence the cpumask
bounds check triggers when clearing the bits past nr_cpu_ids.
Add a helper which allows to reset cpu_possible_map w/o the bounds check
and then set only the possible bits which are well inside bounds.
Reported-by: Dmitry Safonov <[email protected]>
Cc: Rusty Russell <[email protected]>
Cc: [email protected]
Cc: Jan Beulich <[email protected]>
Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1612131836050.3415@nanos
Signed-off-by: Thomas Gleixner <[email protected]>
Diffstat (limited to 'net')
0 files changed, 0 insertions, 0 deletions