From: Jens Axboe <axboe@fb.com>
Date: Mon, 24 Nov 2014 22:02:42 +0000 (-0700)
Subject: blk-mq: use 'nr_cpu_ids' as highest CPU ID count for hwq <-> cpu map
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a33c1ba2913802b6fb23e974bb2f6a4e73c8b7ce;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git

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>
---

diff --git a/block/blk-mq-cpumap.c b/block/blk-mq-cpumap.c
index 1065d7c65fa1..72e5ed691e37 100644
--- a/block/blk-mq-cpumap.c
+++ b/block/blk-mq-cpumap.c
@@ -90,7 +90,7 @@ unsigned int *blk_mq_make_queue_map(struct blk_mq_tag_set *set)
 	unsigned int *map;
 
 	/* If cpus are offline, map them to first hctx */
-	map = kzalloc_node(sizeof(*map) * num_possible_cpus(), GFP_KERNEL,
+	map = kzalloc_node(sizeof(*map) * nr_cpu_ids, GFP_KERNEL,
 				set->numa_node);
 	if (!map)
 		return NULL;