Re: [PATCH v4 16/24] alpha/PCI: Remove WARN from __pci_mmap_fits()

Ilpo Järvinen
2026-04-13T11:45:49Z

[-- Attachment #1: Type: text/plain, Size: 1357 bytes --]

On Sat, 11 Apr 2026, Krzysztof Wilczyński wrote:

> 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").
>
> Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
> ---
> arch/alpha/kernel/pci-sysfs.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/arch/alpha/kernel/pci-sysfs.c b/arch/alpha/kernel/pci-sysfs.c
> index 2748000a7486..c136603ddf2c 100644
> --- a/arch/alpha/kernel/pci-sysfs.c
> +++ b/arch/alpha/kernel/pci-sysfs.c
> @@ -48,13 +48,7 @@ static int __pci_mmap_fits(struct pci_dev *pdev, int num,
> start = vma->vm_pgoff;
> size = ((len - 1) >> (PAGE_SHIFT - shift)) + 1;
>
> - if (start < size && size - start >= nr)
> - return 1;
> - WARN(1, "process \"%s\" tried to map%s 0x%08lx-0x%08lx on %s BAR %d "
> - "(size 0x%08lx)\n",
> - current->comm, sparse ? " sparse" : "", start, start + nr,
> - pci_name(pdev), num, size);
> - return 0;
> + return start < size && size - start >= nr;
> }
>
> /**
>

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

--
i.