linux/arch/alpha
Krzysztof Wilczyński dcb638b472 alpha/PCI: Fix __pci_mmap_fits() overflow for zero-length BARs
[ Upstream commit 802a3b3f47 ]

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.

Add an early return for empty resources.

Fixes: 10a0ef39fb ("PCI/alpha: pci sysfs resources")
Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
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-15-kwilczynski@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-07-24 15:51:41 +02:00
..
boot alpha/boot/tools/objstrip: fix the check for ELF header 2023-03-10 09:39:35 +01:00
configs alpha: defconfig: add necessary configs for boot testing 2021-07-25 22:33:03 -07:00
include alpha: don't reference obsolete termio struct for TC* constants 2026-01-19 13:10:15 +01:00
kernel alpha/PCI: Fix __pci_mmap_fits() overflow for zero-length BARs 2026-07-24 15:51:41 +02:00
lib alpha: move __udiv_qrnnd library function to arch/alpha/lib/ 2021-09-18 14:45:48 -07:00
math-emu alpha: move __udiv_qrnnd library function to arch/alpha/lib/ 2021-09-18 14:45:48 -07:00
mm alpha: align stack for page fault and user unaligned trap handlers 2025-03-13 12:50:40 +01:00
Kbuild alpha: move core-y in arch/alpha/Makefile to arch/alpha/Kbuild 2021-05-26 23:11:47 +09:00
Kconfig alpha: enable GENERIC_PCI_IOMAP unconditionally 2021-09-19 10:37:00 -07:00
Kconfig.debug treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile alpha: move core-y in arch/alpha/Makefile to arch/alpha/Kbuild 2021-05-26 23:11:47 +09:00