[lvc-project] [PATCH] mpt3sas: Check if the variable 'nr_msix' is equal to zero

Fedor Pchelkin pchelkin at ispras.ru
Tue Dec 16 12:41:29 MSK 2025


On Mon, 21. Apr 11:26, Ваторопин Андрей wrote:
> From: Andrey Vatoropin <a.vatoropin at crpt.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 at crpt.ru>
> ---

По https://lvc-svacer.ispras.ru/r/d39ud5pr8jq8abvf8ui0 нашёл патч,
он применим к 6.1/6.12 и сеёчас его добавлю.

Для 5.10 просьба выслать вариант патча в список lvc-patches at linuxtesting.org,
пометив [PATCH 5.10] в теме письма.  *Описание патча стоит оставить тем же*.

>  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



More information about the lvc-project mailing list