linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] crypto: nitrox - fix unchecked variable in nitrox_register_interrupts
@ 2021-06-01 10:01 Tong Tiangen
  2021-06-11  7:16 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Tong Tiangen @ 2021-06-01 10:01 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: linux-crypto, linux-kernel, Tong Tiangen

Function nitrox_register_interrupts leaves variable 'nr_vecs' unchecked, which
would be use as kcalloc parameter later.

Fixes: 5155e118dda9 ("crypto: cavium/nitrox - use pci_alloc_irq_vectors() while enabling MSI-X.")
Signed-off-by: Tong Tiangen <tongtiangen@huawei.com>
---
 drivers/crypto/cavium/nitrox/nitrox_isr.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/crypto/cavium/nitrox/nitrox_isr.c b/drivers/crypto/cavium/nitrox/nitrox_isr.c
index c288c4b51783..f19e520da6d0 100644
--- a/drivers/crypto/cavium/nitrox/nitrox_isr.c
+++ b/drivers/crypto/cavium/nitrox/nitrox_isr.c
@@ -307,6 +307,10 @@ int nitrox_register_interrupts(struct nitrox_device *ndev)
 	 * Entry 192: NPS_CORE_INT_ACTIVE
 	 */
 	nr_vecs = pci_msix_vec_count(pdev);
+	if (nr_vecs < 0) {
+		dev_err(DEV(ndev), "Error in getting vec count %d\n", nr_vecs);
+		return nr_vecs;
+	}
 
 	/* Enable MSI-X */
 	ret = pci_alloc_irq_vectors(pdev, nr_vecs, nr_vecs, PCI_IRQ_MSIX);
-- 
2.18.0.huawei.25


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] crypto: nitrox - fix unchecked variable in nitrox_register_interrupts
  2021-06-01 10:01 [PATCH -next] crypto: nitrox - fix unchecked variable in nitrox_register_interrupts Tong Tiangen
@ 2021-06-11  7:16 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2021-06-11  7:16 UTC (permalink / raw)
  To: Tong Tiangen; +Cc: David S. Miller, linux-crypto, linux-kernel

On Tue, Jun 01, 2021 at 06:01:55PM +0800, Tong Tiangen wrote:
> Function nitrox_register_interrupts leaves variable 'nr_vecs' unchecked, which
> would be use as kcalloc parameter later.
> 
> Fixes: 5155e118dda9 ("crypto: cavium/nitrox - use pci_alloc_irq_vectors() while enabling MSI-X.")
> Signed-off-by: Tong Tiangen <tongtiangen@huawei.com>
> ---
>  drivers/crypto/cavium/nitrox/nitrox_isr.c | 4 ++++
>  1 file changed, 4 insertions(+)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-11  7:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-01 10:01 [PATCH -next] crypto: nitrox - fix unchecked variable in nitrox_register_interrupts Tong Tiangen
2021-06-11  7:16 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).