Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
To: jgg@nvidia.com, leon@kernel.org
Cc: linux-rdma@vger.kernel.org,
	Dan Carpenter <dan.carpenter@linaro.org>,
	Tatyana Nikolova <tatyana.e.nikolova@intel.com>
Subject: [PATCH for-rc 2/2] ice, irdma: fix an off by one in error handling code
Date: Mon, 14 Apr 2025 18:42:31 -0500	[thread overview]
Message-ID: <20250414234231.523-2-tatyana.e.nikolova@intel.com> (raw)
In-Reply-To: <20250414234231.523-1-tatyana.e.nikolova@intel.com>

From: Dan Carpenter <dan.carpenter@linaro.org>

If we don't allocate the MIN number of IRQs then we need to free what
we have and return -ENOMEM.  The problem is this loop is off by one
so it frees an entry that wasn't allocated and it doesn't free the
first entry where i == 0.

Fixes: 3e0d3cb3fbe0 ("ice, irdma: move interrupts code to irdma")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
---
 drivers/infiniband/hw/irdma/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/irdma/main.c b/drivers/infiniband/hw/irdma/main.c
index d10fd16dcec3..7599e31b5743 100644
--- a/drivers/infiniband/hw/irdma/main.c
+++ b/drivers/infiniband/hw/irdma/main.c
@@ -221,7 +221,7 @@ static int irdma_init_interrupts(struct irdma_pci_f *rf, struct ice_pf *pf)
 			break;
 
 	if (i < IRDMA_MIN_MSIX) {
-		for (; i > 0; i--)
+		while (--i >= 0)
 			ice_free_rdma_qvector(pf, &rf->msix_entries[i]);
 
 		kfree(rf->msix_entries);
-- 
2.31.1


  reply	other threads:[~2025-04-14 23:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-14 23:42 [PATCH for-rc 1/2] irdma: free iwdev->rf after removing MSI-X Tatyana Nikolova
2025-04-14 23:42 ` Tatyana Nikolova [this message]
2025-04-20 10:56 ` Leon Romanovsky

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=20250414234231.523-2-tatyana.e.nikolova@intel.com \
    --to=tatyana.e.nikolova@intel.com \
    --cc=dan.carpenter@linaro.org \
    --cc=jgg@nvidia.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    /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