lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f66b15a3-1d83-43f9-8af2-071b76b133c0@intel.com>
Date: Wed, 12 Feb 2025 17:46:54 +0100
From: Alexander Lobakin <aleksander.lobakin@...el.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
CC: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>, Tony Nguyen
	<anthony.l.nguyen@...el.com>, Przemek Kitszel <przemyslaw.kitszel@...el.com>,
	Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, "Paolo
 Abeni" <pabeni@...hat.com>, Jacob Keller <jacob.e.keller@...el.com>,
	"Wojciech Drewek" <wojciech.drewek@...el.com>,
	<intel-wired-lan@...ts.osuosl.org>, <netdev@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH next] ice: Fix signedness bug in
 ice_init_interrupt_scheme()

From: Dan Carpenter <dan.carpenter@...aro.org>
Date: Wed, 12 Feb 2025 18:27:09 +0300

> [PATCH next] ice: Fix signedness bug in ice_init_interrupt_scheme()

I believe it should be "PATCH net" with

> 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.
> 
> Fixes: 79d97b8cf9a8 ("ice: remove splitting MSI-X between features")

a 'Stable:' tag here.

> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
> ---
>  drivers/net/ethernet/intel/ice/ice_irq.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_irq.c b/drivers/net/ethernet/intel/ice/ice_irq.c
> index cbae3d81f0f1..b1fdad154203 100644
> --- a/drivers/net/ethernet/intel/ice/ice_irq.c
> +++ b/drivers/net/ethernet/intel/ice/ice_irq.c
> @@ -149,7 +149,7 @@ 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)
> +	if (vectors < 0)
>  		return -ENOMEM;

This pattern most likely repeats in other Intel drivers >_<

BTW it's a bit weird that we return -ENOMEM here, although we have a
precise errno in case of error. Shouldn't we do `return vectors` here?

(but this is more of an improvement, not a fix, so out of this patch's
 scope)

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

Thanks,
Olek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ