Commit a33c1ba2913802b6fb23e974bb2f6a4e73c8b7ce

Authored by Jens Axboe
1 parent 394ffa503b

blk-mq: use 'nr_cpu_ids' as highest CPU ID count for hwq <-> cpu map

We currently use num_possible_cpus(), but that breaks on sparc64 where
the CPU ID space is discontig. Use nr_cpu_ids as the highest CPU ID
instead, so we don't end up reading from invalid memory.

Cc: stable@kernel.org # 3.13+
Signed-off-by: Jens Axboe <axboe@fb.com>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

block/blk-mq-cpumap.c
... ... @@ -90,7 +90,7 @@
90 90 unsigned int *map;
91 91  
92 92 /* If cpus are offline, map them to first hctx */
93   - map = kzalloc_node(sizeof(*map) * num_possible_cpus(), GFP_KERNEL,
  93 + map = kzalloc_node(sizeof(*map) * nr_cpu_ids, GFP_KERNEL,
94 94 set->numa_node);
95 95 if (!map)
96 96 return NULL;