Re: [PATCH 2/2] PCI: endpoint: pci-epf-ntb: Add check to detect 'db_count' value of 0

Krzysztof WilczyƄski <[email protected]> Tue, 12 May 2026 14:29:18 +0900
Newsgroups dev.linux.lists.ntb,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci
Message-ID <20260512051926.GA1687877@rocinante>
Hello,

> @@ -1297,12 +1300,12 @@ static int epf_ntb_configure_interrupt(struct epf_ntb *ntb,
>  	vfunc_no = ntb_epc->vfunc_no;
>  
>  	db_count = ntb->db_count;
> -	if (db_count > MAX_DB_COUNT) {
> -		dev_err(dev, "DB count cannot be more than %d\n", MAX_DB_COUNT);
> +	if (!db_count || db_count > MAX_DB_COUNT) {
> +		dev_err(dev, "DB count %d out of range (1 - %d)\n",
> +			db_count, MAX_DB_COUNT);
>  		return -EINVAL;
>  	}

Something that I was wondering about here: would it make sense to also
remove this variable from here, too?  Even though it's referenced below
here (which is why I think you left it here).  Thoughts?

Thank you!

	Krzysztof