Skip to content

Commit 1704a96

Browse files
arndbgregkh
authored andcommitted
vfio-pci: use 32-bit comparisons for register address for gcc-4.5
[ 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. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 7de922c commit 1704a96

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/vfio/pci/vfio_pci_rdwr.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,10 @@ ssize_t vfio_pci_vga_rw(struct vfio_pci_device *vdev, char __user *buf,
190190
if (!vdev->has_vga)
191191
return -EINVAL;
192192

193-
switch (pos) {
193+
if (pos > 0xbfffful)
194+
return -EINVAL;
195+
196+
switch ((u32)pos) {
194197
case 0xa0000 ... 0xbffff:
195198
count = min(count, (size_t)(0xc0000 - pos));
196199
iomem = ioremap_nocache(0xa0000, 0xbffff - 0xa0000 + 1);

0 commit comments

Comments
 (0)