Re: [PATCH 13/20] alpha/PCI: Clean up __pci_mmap_fits()

Krzysztof Wilczyński <[email protected]>
Newsgroups org.kernel.vger.linux-alpha,org.kernel.vger.linux-pci,org.ozlabs.lists.linuxppc-dev
Message-ID <20260410112132.GA1756033@rocinante>
Hello,

> > Currently, __pci_mmap_fits() computes the BAR size using
> > pci_resource_len() - 1, which wraps to a large value when the
> > BAR length is zero, causing the bounds check to incorrectly
> > succeed.
> > 
> > Thus, add an early return for empty resources.
> > 
> > Also, remove the WARN() that fires when userspace attempts to
> > mmap beyond the BAR bounds.  The check still returns 0 to reject
> > the mapping, but the warning is excessive for normal operation.
> > 
> > A similar warning was removed from the PCI core in the commit
> > 3b519e4ea618 ("PCI: fix size checks for mmap() on /proc/bus/pci files").
> 
> This looks like entirely separate two changes to me which just happen 
> within the same context.

True.  I could split this into two separate patches.  However, the early
return is so trivial, that I decided to keep it here, in lieu of that the
linked patch did, too.

Thoughts?

Thank you!

	Krzysztof
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.