Skip to content

Commit c2ddb61

Browse files
Dan Carpenterkuba-moo
authored andcommitted
ice: Fix signedness bug in ice_init_interrupt_scheme()
If pci_alloc_irq_vectors() can't allocate the minimum number of vectors then it returns -ENOSPC so there is no need to check for that in the caller. In fact, because pf->msix.min is an unsigned int, it means that any negative error codes are type promoted to high positive values and treated as success. So here, the "return -ENOMEM;" is unreachable code. Check for negatives instead. Now that we're only dealing with error codes, it's easier to propagate the error code from pci_alloc_irq_vectors() instead of hardcoding -ENOMEM. Fixes: 79d97b8 ("ice: remove splitting MSI-X between features") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Michal Swiatkowski <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent de38503 commit c2ddb61

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/ethernet/intel/ice/ice_irq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ int ice_init_interrupt_scheme(struct ice_pf *pf)
149149

150150
vectors = pci_alloc_irq_vectors(pf->pdev, pf->msix.min, vectors,
151151
PCI_IRQ_MSIX);
152-
if (vectors < pf->msix.min)
153-
return -ENOMEM;
152+
if (vectors < 0)
153+
return vectors;
154154

155155
ice_init_irq_tracker(pf, pf->msix.max, vectors);
156156

0 commit comments

Comments
 (0)