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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/blk-mq-cpumap.c b/block/blk-mq-cpumap.c index 3db84d319..dc440870e 100644 --- a/block/blk-mq-cpumap.c +++ b/block/blk-mq-cpumap.c @@ -65,7 +65,8 @@ int blk_mq_map_queues(struct blk_mq_queue_map *qmap) } else { first_sibling = get_first_sibling(cpu); if (first_sibling == cpu) - map[cpu] = queue_index(qmap, nr_queues, q++); + if (nr_queues) + map[cpu] = queue_index(qmap, nr_queues, q++); else map[cpu] = map[first_sibling]; } -- 2.25.1