Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>,
	Mustafa Ismail <mustafa.ismail@intel.com>,
	Tatyana Nikolova <tatyana.e.nikolova@intel.com>,
	Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	Jacob Keller <jacob.e.keller@intel.com>,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH next] ice, irdma: fix an off by one in error handling code
Date: Thu, 13 Feb 2025 06:47:16 +0100	[thread overview]
Message-ID: <Z62HZM0xjSWSSBiL@mev-dev.igk.intel.com> (raw)
In-Reply-To: <47e9c9a0-c943-440c-aea7-75ff189c5f97@stanley.mountain>

On Wed, Feb 12, 2025 at 06:25:44PM +0300, Dan Carpenter wrote:
> 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>
> ---
>  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 1ee8969595d3..5fc081ca8905 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);

Przemek pointed that in the review, but somehow I missed that :( .
Thanks for fixing:
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>

> -- 
> 2.47.2
> 

  reply	other threads:[~2025-02-13  5:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-12 15:25 [PATCH next] ice, irdma: fix an off by one in error handling code Dan Carpenter
2025-02-13  5:47 ` Michal Swiatkowski [this message]
2025-02-14 19:47 ` Tony Nguyen

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=Z62HZM0xjSWSSBiL@mev-dev.igk.intel.com \
    --to=michal.swiatkowski@linux.intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=dan.carpenter@linaro.org \
    --cc=jacob.e.keller@intel.com \
    --cc=jgg@ziepe.ca \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mustafa.ismail@intel.com \
    --cc=tatyana.e.nikolova@intel.com \
    /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