Re: [PATCH v8 0/5] PCI: endpoint: BAR subrange mapping support

Niklas Cassel
2026-01-23T10:16:28Z

On Fri, Jan 23, 2026 at 09:35:01AM +0100, Niklas Cassel wrote:
>
> pci_epf_test_enable_doorbell() simply does:
> pci_epc_get_next_free_bar() to get a BAR, then writes the BAR
> number in the in the pci-epf-test command registers, offset:
> PCI_ENDPOINT_TEST_DB_BAR 0x34
>
> However, the doorbells are most likely very small, so the chances
> that reg->doorbell_offset will have a value that is smaller than
> BAR size seems likely... but not guaranteed... and there is no
>
> if (reg->doorbell_offset > epf->bar[bar].size)
> goto err_doorbell_cleanup;
>
> So it seems that this doorbell test just ignores the problem...
>
> Frank, could you perhaps send a patch to add something like the above?

Frank, I guess the check would actually have to be something like:

if (reg->doorbell_offset + size of the doorbell > epf->bar[bar].size)
goto err_doorbell_cleanup;

Kind regards,
Niklas