From: Dan Carpenter Date: Thu, 13 Feb 2025 06:31:41 +0000 (+0300) Subject: ice: Fix signedness bug in ice_init_interrupt_scheme() X-Git-Tag: v6.15-rc1~160^2~316 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c2ddb619fa8d535af968965181656c20a6de3f81;p=thirdparty%2Flinux.git 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: 79d97b8cf9a8 ("ice: remove splitting MSI-X between features") Signed-off-by: Dan Carpenter Reviewed-by: Michal Swiatkowski Link: https://patch.msgid.link/b16e4f01-4c85-46e2-b602-fce529293559@stanley.mountain Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/ethernet/intel/ice/ice_irq.c b/drivers/net/ethernet/intel/ice/ice_irq.c index cbae3d81f0f1d..30801fd375f01 100644 --- a/drivers/net/ethernet/intel/ice/ice_irq.c +++ b/drivers/net/ethernet/intel/ice/ice_irq.c @@ -149,8 +149,8 @@ int ice_init_interrupt_scheme(struct ice_pf *pf) vectors = pci_alloc_irq_vectors(pf->pdev, pf->msix.min, vectors, PCI_IRQ_MSIX); - if (vectors < pf->msix.min) - return -ENOMEM; + if (vectors < 0) + return vectors; ice_init_irq_tracker(pf, pf->msix.max, vectors);