提交 10af1156 编写于 作者: J Jinyoung Choi 提交者: Martin K. Petersen

scsi: ufs: core: Fix divide by zero in ufshcd_map_queues()

Before calling blk_mq_map_queues(), the mq_map and nr_queues belonging to
struct blk_mq_queue_map must have a valid value.

If nr_queues is set to 0, the system may encounter a divide by zero
depending on the type of architecture.

    blk_mq_map_queues() -> queue_index()

Link: https://lore.kernel.org/r/1891546521.01644873481638.JavaMail.epsvc@epcpadp4Reviewed-by: NBart Van Assche <bvanassche@acm.org>
Signed-off-by: NJinyoung Choi <j-young.choi@samsung.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 7f4c5a26
......@@ -2681,7 +2681,7 @@ static int ufshcd_map_queues(struct Scsi_Host *shost)
break;
case HCTX_TYPE_READ:
map->nr_queues = 0;
break;
continue;
default:
WARN_ON_ONCE(true);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册