Skip to contentSkip to conversation

Patch "vfio-pci: use 32-bit comparisons for register address for gcc-4.5" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Aug 4, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

vfio-pci: use 32-bit comparisons for register address for gcc-4.5

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
vfio-pci-use-32-bit-comparisons-for-register-address-for-gcc-4.5.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Fri Aug 4 13:32:40 PDT 2017

From: Arnd Bergmann <[email protected]>
Date: Fri, 30 Dec 2016 08:13:47 -0700
Subject: vfio-pci: use 32-bit comparisons for register address for gcc-4.5

From: Arnd Bergmann <[email protected]>

[ Upstream commit 45e869714489431625c569d21fc952428d761476 ]

Using ancient compilers (gcc-4.5 or older) on ARM, we get a link failure with the vfio-pci driver:

ERROR: "__aeabi_lcmp" [drivers/vfio/pci/vfio-pci.ko] undefined!

The reason is that the compiler tries to do a comparison of a 64-bit range. This changes it to convert to a 32-bit number explicitly first, as newer compilers do for themselves.

---
 drivers/vfio/pci/vfio_pci_rdwr.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/vfio/pci/vfio_pci_rdwr.c +4 -1
@@ -193,7 +193,10 @@ ssize_t vfio_pci_vga_rw(struct vfio_pci_
 	if (!vdev->has_vga)
 		return -EINVAL;
 
-	switch (pos) {
+	if (pos > 0xbfffful)
+		return -EINVAL;
+
+	switch ((u32)pos) {
 	case 0xa0000 ... 0xbffff:
 		count = min(count, (size_t)(0xc0000 - pos));
 		iomem = ioremap_nocache(0xa0000, 0xbffff - 0xa0000 + 1);

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/vfio-pci-use-32-bit-comparisons-for-register-address-for-gcc-4.5.patch queue-4.9/drm-vmwgfx-fix-gcc-7.1.1-warning.patch