Linux virtualization list
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Shijith Thotton <sthotton@marvell.com>
Cc: virtualization@lists.linux.dev
Subject: [bug report] vdpa/octeon_ep: enable support for multiple interrupts per device
Date: Wed, 15 Oct 2025 12:49:31 +0300	[thread overview]
Message-ID: <aO9uK3LmhajmbPfF@stanley.mountain> (raw)

Hello Shijith Thotton,

Commit 26f8ce06af64 ("vdpa/octeon_ep: enable support for multiple
interrupts per device") from Jan 3, 2025 (linux-next), leads to the
following issue:

drivers/vdpa/octeon_ep/octep_vdpa_main.c:114:	ret = pci_alloc_irq_vectors(pdev, 1, oct_hw->nb_irqs, PCI_IRQ_MSIX);
This assumes that pci_alloc_irq_vectors() allocates the maximum.

drivers/vdpa/octeon_ep/octep_vdpa_main.c
    104 
    105 static int octep_request_irqs(struct octep_hw *oct_hw)
    106 {
    107         struct pci_dev *pdev = oct_hw->pdev;
    108         int ret, irq, idx;
    109 
    110         oct_hw->irqs = devm_kcalloc(&pdev->dev, oct_hw->nb_irqs, sizeof(int), GFP_KERNEL);
    111         if (!oct_hw->irqs)
    112                 return -ENOMEM;
    113 
--> 114         ret = pci_alloc_irq_vectors(pdev, 1, oct_hw->nb_irqs, PCI_IRQ_MSIX);
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The pci_alloc_irq_vectors() takes a range between 1 and oct_hw->nb_irqs.
If it can't allocate the minimum (1) it will return a negative error
code, otherwise it will return a number between 1 and oct_hw->nb_irqs
inclusive.

    115         if (ret < 0) {
    116                 dev_err(&pdev->dev, "Failed to alloc msix vector");
    117                 return ret;
    118         }
    119 
    120         for (idx = 0; idx < oct_hw->nb_irqs; idx++) {
                                    ^^^^^^^^^^^^^^^
This should be "ret".  We can't assume it allocated all the irq
vectors.

    121                 irq = pci_irq_vector(pdev, idx);
    122                 ret = devm_request_irq(&pdev->dev, irq, octep_vdpa_intr_handler, 0,
    123                                        dev_name(&pdev->dev), oct_hw);
    124                 if (ret) {

regards,
dan carpenter

                 reply	other threads:[~2025-10-15  9:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aO9uK3LmhajmbPfF@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=sthotton@marvell.com \
    --cc=virtualization@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox