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

From: Manivannan Sadhasivam

Date: Wed May 27 2026 - 04:24:22 EST


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

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