In function blk_mq_map_queues, qmap->nr_queues may equal zero and thus it needs to be checked before we pass it to function queue_index. Signed-off-by: Yiyuan GUO <yguoaz@xxxxxxxxxx> --- block/blk-mq-cpumap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-mq-cpumap.c b/block/blk-mq-cpumap.c index 3db84d319..c2163658e 100644 --- a/block/blk-mq-cpumap.c +++ b/block/blk-mq-cpumap.c @@ -64,7 +64,7 @@ int blk_mq_map_queues(struct blk_mq_queue_map *qmap) map[cpu] = queue_index(qmap, nr_queues, q++); } else { first_sibling = get_first_sibling(cpu); - if (first_sibling == cpu) + if ((first_sibling == cpu) && nr_queues) map[cpu] = queue_index(qmap, nr_queues, q++); else map[cpu] = map[first_sibling]; -- 2.25.1