public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [bug report] scsi: ufs: host: mediatek: Set IRQ affinity policy for MCQ mode
@ 2025-08-01 13:18 Dan Carpenter
  2025-08-04  5:59 ` Peter Wang (王信友)
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-08-01 13:18 UTC (permalink / raw)
  To: Peter Wang; +Cc: linux-scsi, linux-mediatek

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [bug report] scsi: ufs: host: mediatek: Set IRQ affinity policy for MCQ mode
  2025-08-01 13:18 [bug report] scsi: ufs: host: mediatek: Set IRQ affinity policy for MCQ mode Dan Carpenter
@ 2025-08-04  5:59 ` Peter Wang (王信友)
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Wang (王信友) @ 2025-08-04  5:59 UTC (permalink / raw)
  To: dan.carpenter@linaro.org
  Cc: linux-scsi@vger.kernel.org, linux-mediatek@lists.infradead.org

On Fri, 2025-08-01 at 16:18 +0300, Dan Carpenter wrote:
> 
> 
>     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

Hi Dan,

Yes, this is indeed a coding defect that needs to be fixed.
I will correct it.

Thanks.
Peter


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-04  5:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-01 13:18 [bug report] scsi: ufs: host: mediatek: Set IRQ affinity policy for MCQ mode Dan Carpenter
2025-08-04  5:59 ` Peter Wang (王信友)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox