Skip to content

Commit 2f38fd9

Browse files
wangshuaiweimartinkpetersen
authored andcommitted
scsi: ufs: core: Fix shift out of bounds when MAXQ=32
According to JESD223F, the maximum number of queues (MAXQ) is 32. When MCQ is enabled and ESI is disabled, nr_hw_queues=32 causes a shift overflow problem. Fix this by using 64-bit intermediate values to handle the nr_hw_queues=32 case safely. Signed-off-by: wangshuaiwei <wangshuaiwei1@xiaomi.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Link: https://patch.msgid.link/20260224063228.50112-1-wangshuaiwei1@xiaomi.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 62c0153 commit 2f38fd9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7110,7 +7110,7 @@ static irqreturn_t ufshcd_handle_mcq_cq_events(struct ufs_hba *hba)
71107110

71117111
ret = ufshcd_vops_get_outstanding_cqs(hba, &outstanding_cqs);
71127112
if (ret)
7113-
outstanding_cqs = (1U << hba->nr_hw_queues) - 1;
7113+
outstanding_cqs = (1ULL << hba->nr_hw_queues) - 1;
71147114

71157115
/* Exclude the poll queues */
71167116
nr_queues = hba->nr_hw_queues - hba->nr_queues[HCTX_TYPE_POLL];

0 commit comments

Comments
 (0)