scsi: ufs: host: mediatek: Set IRQ affinity policy for MCQ mode
Subsystems (2)
Hello Peter Wang,
Commit 66e26a4b8a77 ("scsi: ufs: host: mediatek: Set IRQ affinity policy for MCQ mode") from Jul 22, 2025 (linux-next), leads to the following *UNPUBLISHED* Smatch static checker warning:
drivers/ufs/host/ufs-mediatek.c:827 ufs_mtk_mcq_get_irq() warn: array off by one? 'host->mcq_intr_info[q_index]'
drivers/ufs/host/ufs-mediatek.c
812 static u32 ufs_mtk_mcq_get_irq(struct ufs_hba *hba, unsigned int cpu)
813 {
814 struct ufs_mtk_host *host = ufshcd_get_variant(hba);
815 struct blk_mq_tag_set *tag_set = &hba->host->tag_set;
816 struct blk_mq_queue_map *map = &tag_set->map[HCTX_TYPE_DEFAULT];
817 unsigned int nr = map->nr_queues;
818 unsigned int q_index;
819
820 q_index = map->mq_map[cpu];
821 if (q_index > nr) {This really looks like it should be ">= nr" instead of "> nr" but I'm not certain enough to send a patch for it. Could you take a look?
822 dev_err(hba->dev, "hwq index %d exceed %d\n",
823 q_index, nr);
824 return MTK_MCQ_INVALID_IRQ;
825 }
826
--> 827 return host->mcq_intr_info[q_index].irq;
828 }regards,
dan carpenter
Quoted 16 lines · Dan Carpenter
821 if (
q_index> nr) {This really looks like it should be ">= nr" instead of "> nr" but I'm not
certain enough to send a patch for it. Could you take a look?822 dev_err(hba->dev, "hwq index %d exceed %d\n", 823
q_index, nr);
824 returnMTK_MCQ_INVALID_IRQ;
825 }
826
--> 827 return host->mcq_intr_info[q_index].irq; 828 }
Quoted 2 lines
regards,
dan carpenter
Hi Dan,
Yes, this is indeed a coding defect that needs to be fixed. I will correct it.
Thanks.
Peter