Skip to content

Commit 4bcc063

Browse files
Dan Carpenterrleon
authored andcommitted
ice, irdma: fix an off by one in error handling code
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: 3e0d3cb ("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> Link: https://patch.msgid.link/20250414234231.523-2-tatyana.e.nikolova@intel.com Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com> Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent 80f2ab4 commit 4bcc063

File tree

1 file changed

+1
-1
lines changed
  • drivers/infiniband/hw/irdma

1 file changed

+1
-1
lines changed

drivers/infiniband/hw/irdma/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ static int irdma_init_interrupts(struct irdma_pci_f *rf, struct ice_pf *pf)
221221
break;
222222

223223
if (i < IRDMA_MIN_MSIX) {
224-
for (; i > 0; i--)
224+
while (--i >= 0)
225225
ice_free_rdma_qvector(pf, &rf->msix_entries[i]);
226226

227227
kfree(rf->msix_entries);

0 commit comments

Comments
 (0)