From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Wojciech Drewek <wojciech.drewek@intel.com>,
Jacob Keller <jacob.e.keller@intel.com>,
intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [Intel-wired-lan] [PATCH v2 net-next] ice: Fix signedness bug in ice_init_interrupt_scheme()
Date: Thu, 13 Feb 2025 07:55:12 +0100 [thread overview]
Message-ID: <Z62XUG6JzoD0sGAb@mev-dev.igk.intel.com> (raw)
In-Reply-To: <b16e4f01-4c85-46e2-b602-fce529293559@stanley.mountain>
On Thu, Feb 13, 2025 at 09:31:41AM +0300, Dan Carpenter wrote:
> 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 <dan.carpenter@linaro.org>
> ---
> v2: Fix my scripts to say [PATCH net-next]
> Propagate the error code.
>
> drivers/net/ethernet/intel/ice/ice_irq.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_irq.c b/drivers/net/ethernet/intel/ice/ice_irq.c
> index cbae3d81f0f1..30801fd375f0 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);
>
Thanks,
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> --
> 2.47.2
>
next prev parent reply other threads:[~2025-02-13 6:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-13 6:31 [Intel-wired-lan] [PATCH v2 net-next] ice: Fix signedness bug in ice_init_interrupt_scheme() Dan Carpenter
2025-02-13 6:55 ` Michal Swiatkowski [this message]
2025-02-15 3:50 ` patchwork-bot+netdevbpf
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=Z62XUG6JzoD0sGAb@mev-dev.igk.intel.com \
--to=michal.swiatkowski@linux.intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=dan.carpenter@linaro.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jacob.e.keller@intel.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=wojciech.drewek@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