On 5/14/21 11:16 AM, Yiyuan GUO wrote: > 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]; > } > Err ... and what is the value of 'map[cpu]' if 'nr_queues' equals zero? Please move the 'if (nr_queues)' condition into the first if-clause: if ((first_sibling == cpu) && nr_queues) Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@xxxxxxx +49 911 74053 688 SUSE Software Solutions Germany GmbH, 90409 Nürnberg GF: F. Imendörffer, HRB 36809 (AG Nürnberg)