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 <[email protected]>
Reviewed-by: Ilpo Järvinen <[email protected]>
Acked-by: Magnus Lindholm <[email protected]>
Signed-off-by: Krzysztof Wilczyński <[email protected]>
---
 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.54.0


Reply via email to