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

Manivannan Sadhasivam <[email protected]> Wed, 27 May 2026 10:24:06 +0200
Newsgroups dev.linux.lists.ntb,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci
Message-ID <wqog727cep7dhodxvpp3jfnfy3ce6kag64dahjd2vawxbkjrju@35immqrbyekm>
On Tue, May 12, 2026 at 02:29:18PM +0900, Krzysztof Wilczyński wrote:
> 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?
> 

Makes sense. I removed 'db_count' variable while applying, thanks for spotting!

- Mani

-- 
மணிவண்ணன் சதாசிவம்