[PATCH v5 15/23] alpha/PCI: Remove WARN from __pci_mmap_fits()

Krzysztof Wilczyński
2026-04-16T18:03:12Z

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").

Tested-by: Magnus Lindholm <linmag7@gmail.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Acked-by: Magnus Lindholm <linmag7@gmail.com>
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 8802f955256e..f2ee737c588c 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;
}

/**
--
2.53.0