android_kernel_oneplus_msm8998/arch/mips
Paul Burton 97e066123d MIPS: Fix off-by-one in pci_resource_to_user()
commit 38c0a74fe06da3be133cae3fb7bde6a9438e698b upstream.

The MIPS implementation of pci_resource_to_user() introduced in v3.12 by
commit 4c2924b725 ("MIPS: PCI: Use pci_resource_to_user to map pci
memory space properly") incorrectly sets *end to the address of the
byte after the resource, rather than the last byte of the resource.

This results in userland seeing resources as a byte larger than they
actually are, for example a 32 byte BAR will be reported by a tool such
as lspci as being 33 bytes in size:

    Region 2: I/O ports at 1000 [disabled] [size=33]

Correct this by subtracting one from the calculated end address,
reporting the correct address to userland.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Reported-by: Rui Wang <rui.wang@windriver.com>
Fixes: 4c2924b725 ("MIPS: PCI: Use pci_resource_to_user to map pci memory space properly")
Cc: James Hogan <jhogan@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: linux-mips@linux-mips.org
Cc: stable@vger.kernel.org # v3.12+
Patchwork: https://patchwork.linux-mips.org/patch/19829/
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-06 16:24:29 +02:00
..
alchemy pcmcia: db1xxx_ss: fix last irq_to_gpio user 2016-04-20 15:42:09 +09:00
ar7 MIPS: AR7: ensure the port type's FCR value is used 2018-01-23 19:50:18 +01:00
ath25 MIPS: ath25: Check for kzalloc allocation failure 2018-03-18 11:17:49 +01:00
ath79 MIPS: ath79: fix register address in ath79_ddr_wb_flush() 2018-07-28 07:45:02 +02:00
bcm47xx MIPS: BCM47XX: Enable 74K Core ExternalSync for PCIe erratum 2018-07-03 11:21:30 +02:00
bcm63xx Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2015-11-15 09:10:53 -08:00
bmips MIPS: Make MIPS_CMDLINE_DTB default 2015-11-11 08:38:37 +01:00
boot MIPS: ath79: Fix the size of the MISC INTC registers in ar9132.dtsi 2015-11-20 12:14:27 +01:00
cavium-octeon MIPS: Octeon: Fix logging messages with spurious periods after newlines 2018-05-30 07:49:16 +02:00
cobalt MIPS: Cobalt Don't use module_init in non-modular MTD registration. 2015-06-21 22:14:30 +02:00
configs MIPS: Update lemote2f_defconfig for CPU_FREQ_STAT change 2017-03-18 19:09:56 +08:00
dec MIPS: DEC: Avoid la pseudo-instruction in delay slots 2017-03-18 19:09:57 +08:00
emma
fw MIPS: ARC: Use __noreturn / unreachable in ARC termination functions. 2015-01-13 16:04:27 +01:00
include MIPS: Fix off-by-one in pci_resource_to_user() 2018-08-06 16:24:29 +02:00
jazz MIPS: Jazz: Migrate to new 'set-state' interface 2015-09-03 12:07:50 +02:00
jz4740 MIPS: JZ4740: Remove unused linux/leds_pwm.h include 2015-10-26 09:49:44 +01:00
kernel MIPS: Use async IPIs for arch_trigger_cpumask_backtrace() 2018-07-22 14:25:54 +02:00
kvm KVM: Fix spelling mistake: "cop_unsuable" -> "cop_unusable" 2018-05-30 07:48:50 +02:00
lantiq MIPS: Lantiq: Fix another request_mem_region() return code check 2017-10-08 10:14:18 +02:00
lasat MIPS: Lasat: Move from deprecated __initcall to arch_initcall. 2015-09-03 12:07:49 +02:00
lib MIPS: memset.S: Fix clobber of v1 in last_fixup 2018-04-24 09:32:10 +02:00
loongson32 MIPS: loongsoon32: Migrate to new 'set-state' interface 2015-09-03 12:07:53 +02:00
loongson64 MIPS: hpet: Increase HPET_MIN_PROG_DELTA and decrease HPET_MIN_CYCLES 2016-08-20 18:09:27 +02:00
math-emu MIPS: math-emu: Fix final emulation phase for certain instructions 2017-12-25 14:22:15 +01:00
mm MIPS: Fix ioremap() RAM check 2018-07-17 11:31:42 +02:00
mti-malta MIPS: Malta: Fix IOCU disable switch read for MIPS64 2016-10-07 15:23:43 +02:00
mti-sead3 LED/MIPS: Move SEAD3 LED driver to where it belongs. 2015-11-03 08:59:20 +01:00
net MIPS: BPF: Fix multiple problems in JIT skb access helpers. 2018-03-22 09:23:25 +01:00
netlogic MIPS: Netlogic: Exclude netlogic,xlp-pic code from XLR builds 2017-11-21 09:21:22 +01:00
oprofile MIPS: Add cases for CPU_I6400 2015-08-26 15:23:03 +02:00
paravirt MIPS: SMP: Don't increment irq_count multiple times for call function IPIs 2015-08-03 09:25:12 +02:00
pci MIPS: Fix build error due to unused variables. 2015-12-22 15:21:18 +01:00
pistachio Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2015-11-15 09:10:53 -08:00
pmcs-msp71xx MIPS: Fix build error due to unused variables. 2015-12-22 15:21:18 +01:00
pnx833x
power MIPS: Hibernate: flush TLB entries earlier 2015-04-10 15:41:52 +02:00
ralink MIPS: ralink: Remove ralink_halt() 2018-03-28 18:40:12 +02:00
rb532 MIPS: Remove all the uses of custom gpio.h 2015-09-03 12:08:02 +02:00
sgi-ip22 MIPS: ip22: Fix ip28 build for modern gcc 2017-03-18 19:09:56 +08:00
sgi-ip27 MIPS: IP27: Migrate to new 'set-state' interface 2015-09-03 12:07:54 +02:00
sgi-ip32 MIPS: IP32: Fix build errors in reset code in DS1685 platform hook. 2015-05-13 00:01:41 +02:00
sibyte MIPS: Sibyte: Move bus watcher from deprecated __initcall to device_initcall 2015-09-03 12:07:49 +02:00
sni MIPS: Fix build error due to unused variables. 2015-12-22 15:21:18 +01:00
txx9 MIPS: TXx9: use IS_BUILTIN() for CONFIG_LEDS_CLASS 2018-05-30 07:48:56 +02:00
vdso MIPS: Fix -mabi=64 build of vdso.lds 2016-10-28 03:01:30 -04:00
vr41xx MIPS/IRQCHIP: Move irq_chip from arch/mips to drivers/irqchip. 2015-06-21 21:52:50 +02:00
xilfpga Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2015-11-15 09:10:53 -08:00
Kbuild MIPS: Initial implementation of a VDSO 2015-11-11 08:36:36 +01:00
Kbuild.platforms MIPS: xilfpga: Add mipsfpga platform code 2015-11-11 08:38:44 +01:00
Kconfig MIPS: fix Select HAVE_IRQ_EXIT_ON_IRQ_STACK patch. 2017-04-21 09:30:08 +02:00
Kconfig.debug MIPS: Remove compact branch policy Kconfig entries 2016-09-30 10:18:39 +02:00
Makefile MIPS: Remove compact branch policy Kconfig entries 2016-09-30 10:18:39 +02:00