[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250421112605.97897-1-a.vatoropin@crpt.ru>
Date: Mon, 21 Apr 2025 11:26:12 +0000
From: Ваторопин Андрей <a.vatoropin@...t.ru>
To: Sathya Prakash <sathya.prakash@...adcom.com>
CC: Ваторопин Андрей <a.vatoropin@...t.ru>, "Sreekanth
Reddy" <sreekanth.reddy@...adcom.com>, Suganath Prabu Subramani
<suganath-prabu.subramani@...adcom.com>, "James E.J. Bottomley"
<James.Bottomley@...senPartnership.com>, "Martin K. Petersen"
<martin.petersen@...cle.com>, "MPT-FusionLinux.pdl@...adcom.com"
<MPT-FusionLinux.pdl@...adcom.com>, "linux-scsi@...r.kernel.org"
<linux-scsi@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "lvc-project@...uxtesting.org"
<lvc-project@...uxtesting.org>
Subject: [PATCH] mpt3sas: Check if the variable 'nr_msix' is equal to zero
From: Andrey Vatoropin <a.vatoropin@...t.ru>
The 'nr_msix' variable is checked for a zero after it is assigned a value.
However, this variable is assigned a value one more time later. After the
second assignment, the check for a zero value does not exist.
Add a check for this variable to ensure it is not zero in order to avoid
division by zero.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 91b265bf0b57 ("mpt3sas: Rework the MSI-X grouping code")
Signed-off-by: Andrey Vatoropin <a.vatoropin@...t.ru>
---
drivers/scsi/mpt3sas/mpt3sas_base.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index bd3efa5b46c7..f9d5c3bfba53 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -3267,6 +3267,8 @@ _base_assign_reply_queues(struct MPT3SAS_ADAPTER *ioc)
fall_back:
cpu = cpumask_first(cpu_online_mask);
nr_msix -= (ioc->high_iops_queues - iopoll_q_count);
+ if (!nr_msix)
+ return;
index = 0;
list_for_each_entry(reply_q, &ioc->reply_queue_list, list) {
--
2.43.0
Powered by blists - more mailing lists