* [PATCH] scsi: ufs: Fix divide zero case in ufshcd_map_queues()
[not found] <CGME20220214103352epcms2p79697c0fcaa2755dd89af9de887ff14cd@epcms2p7>
@ 2022-02-14 10:33 ` Jinyoung CHOI
2022-02-14 23:14 ` Bart Van Assche
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jinyoung CHOI @ 2022-02-14 10:33 UTC (permalink / raw)
To: ALIM AKHTAR, avri.altman, jejb, martin.petersen, bvanassche,
beanhuo, Daejun Park, adrian.hunter, cang, asutoshd, linux-scsi,
linux-kernel
Before calling blk_mq_map_queues(), the mq_map and nr_queues belonging
to "struct blk_mq_queue_map" must be a vaild value.
If nr_queues is set to 0, the system may encounter the "divide zero"
depending on the type of architecture.
blk_mq_map_queues() -> queue_index()
Signed-off-by: Jinyoung Choi <j-young.choi@samsung.com>
---
drivers/scsi/ufs/ufshcd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 41d85b69fa50..36c5ca62ae0c 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -2674,21 +2674,21 @@ static int ufshcd_map_queues(struct Scsi_Host *shost)
for (i = 0; i < shost->nr_maps; i++) {
struct blk_mq_queue_map *map = &shost->tag_set.map[i];
switch (i) {
case HCTX_TYPE_DEFAULT:
case HCTX_TYPE_POLL:
map->nr_queues = 1;
break;
case HCTX_TYPE_READ:
map->nr_queues = 0;
- break;
+ continue;
default:
WARN_ON_ONCE(true);
}
map->queue_offset = 0;
ret = blk_mq_map_queues(map);
WARN_ON_ONCE(ret);
}
return 0;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: ufs: Fix divide zero case in ufshcd_map_queues()
2022-02-14 10:33 ` [PATCH] scsi: ufs: Fix divide zero case in ufshcd_map_queues() Jinyoung CHOI
@ 2022-02-14 23:14 ` Bart Van Assche
[not found] ` <CGME20220214103352epcms2p79697c0fcaa2755dd89af9de887ff14cd@epcms2p5>
2022-02-15 3:18 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Bart Van Assche @ 2022-02-14 23:14 UTC (permalink / raw)
To: j-young.choi, ALIM AKHTAR, avri.altman, jejb, martin.petersen,
beanhuo, Daejun Park, adrian.hunter, cang, asutoshd, linux-scsi,
linux-kernel
On 2/14/22 02:33, Jinyoung CHOI wrote:
> Before calling blk_mq_map_queues(), the mq_map and nr_queues belonging
> to "struct blk_mq_queue_map" must be a vaild value.
^^ ^^^^^
have valid
> If nr_queues is set to 0, the system may encounter the "divide zero"
> depending on the type of architecture.
Anyway:
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE:(2) [PATCH] scsi: ufs: Fix divide zero case in ufshcd_map_queues()
[not found] ` <CGME20220214103352epcms2p79697c0fcaa2755dd89af9de887ff14cd@epcms2p5>
@ 2022-02-15 1:35 ` Jinyoung CHOI
0 siblings, 0 replies; 4+ messages in thread
From: Jinyoung CHOI @ 2022-02-15 1:35 UTC (permalink / raw)
To: Bart Van Assche, ALIM AKHTAR, avri.altman, jejb, martin.petersen,
beanhuo, Daejun Park, adrian.hunter, cang, asutoshd, linux-scsi,
linux-kernel
>On 2/14/22 02:33, Jinyoung CHOI wrote:
>> Before calling blk_mq_map_queues(), the mq_map and nr_queues belonging
>> to "struct blk_mq_queue_map" must be a vaild value.
> ^^ ^^^^^
> have valid
>
>> If nr_queues is set to 0, the system may encounter the "divide zero"
>> depending on the type of architecture.
>
>Anyway:
>
>Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Hi, Bart.
Thanks for your review.
I will be careful of typo. :)
Best Regards,
Jinyoung Choi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: ufs: Fix divide zero case in ufshcd_map_queues()
2022-02-14 10:33 ` [PATCH] scsi: ufs: Fix divide zero case in ufshcd_map_queues() Jinyoung CHOI
2022-02-14 23:14 ` Bart Van Assche
[not found] ` <CGME20220214103352epcms2p79697c0fcaa2755dd89af9de887ff14cd@epcms2p5>
@ 2022-02-15 3:18 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2022-02-15 3:18 UTC (permalink / raw)
To: ALIM AKHTAR, beanhuo, asutoshd, jejb, Daejun Park, cang,
adrian.hunter, linux-kernel, bvanassche, linux-scsi,
Jinyoung CHOI, avri.altman
Cc: Martin K . Petersen
On Mon, 14 Feb 2022 19:33:52 +0900, Jinyoung CHOI wrote:
> Before calling blk_mq_map_queues(), the mq_map and nr_queues belonging
> to "struct blk_mq_queue_map" must be a vaild value.
>
> If nr_queues is set to 0, the system may encounter the "divide zero"
> depending on the type of architecture.
>
> blk_mq_map_queues() -> queue_index()
>
> [...]
Applied to 5.17/scsi-fixes, thanks!
[1/1] scsi: ufs: Fix divide zero case in ufshcd_map_queues()
https://git.kernel.org/mkp/scsi/c/10af11564617
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-02-15 3:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20220214103352epcms2p79697c0fcaa2755dd89af9de887ff14cd@epcms2p7>
2022-02-14 10:33 ` [PATCH] scsi: ufs: Fix divide zero case in ufshcd_map_queues() Jinyoung CHOI
2022-02-14 23:14 ` Bart Van Assche
[not found] ` <CGME20220214103352epcms2p79697c0fcaa2755dd89af9de887ff14cd@epcms2p5>
2022-02-15 1:35 ` Jinyoung CHOI
2022-02-15 3:18 ` Martin K. Petersen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.