mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
alpha/PCI: Remove WARN from __pci_mmap_fits() and __legacy_mmap_fits()
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 3b519e4ea6
("PCI: fix size checks for mmap() on /proc/bus/pci files").
Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
[bhelgaas: squash https://lore.kernel.org/all/20260508045824.GA3160093@rocinante]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Tested-by: Magnus Lindholm <linmag7@gmail.com>
Tested-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Acked-by: Magnus Lindholm <linmag7@gmail.com>
Link: https://patch.msgid.link/20260508043543.217179-16-kwilczynski@kernel.org
This commit is contained in:
parent
802a3b3f47
commit
29840080f5
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -257,9 +251,8 @@ int pci_create_resource_files(struct pci_dev *pdev)
|
|||
|
||||
/* Legacy I/O bus mapping stuff. */
|
||||
|
||||
static int __legacy_mmap_fits(struct pci_controller *hose,
|
||||
struct vm_area_struct *vma,
|
||||
unsigned long res_size, int sparse)
|
||||
static int __legacy_mmap_fits(struct vm_area_struct *vma,
|
||||
unsigned long res_size)
|
||||
{
|
||||
unsigned long nr, start, size;
|
||||
|
||||
|
|
@ -267,13 +260,7 @@ static int __legacy_mmap_fits(struct pci_controller *hose,
|
|||
start = vma->vm_pgoff;
|
||||
size = ((res_size - 1) >> PAGE_SHIFT) + 1;
|
||||
|
||||
if (start < size && size - start >= nr)
|
||||
return 1;
|
||||
WARN(1, "process \"%s\" tried to map%s 0x%08lx-0x%08lx on hose %d "
|
||||
"(size 0x%08lx)\n",
|
||||
current->comm, sparse ? " sparse" : "", start, start + nr,
|
||||
hose->index, size);
|
||||
return 0;
|
||||
return start < size && size - start >= nr;
|
||||
}
|
||||
|
||||
static inline int has_sparse(struct pci_controller *hose,
|
||||
|
|
@ -296,7 +283,7 @@ int pci_mmap_legacy_page_range(struct pci_bus *bus, struct vm_area_struct *vma,
|
|||
|
||||
res_size = (mmap_type == pci_mmap_mem) ? bus->legacy_mem->size :
|
||||
bus->legacy_io->size;
|
||||
if (!__legacy_mmap_fits(hose, vma, res_size, sparse))
|
||||
if (!__legacy_mmap_fits(vma, res_size))
|
||||
return -EINVAL;
|
||||
|
||||
return hose_mmap_page_range(hose, vma, mmap_type, sparse);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user