diff options
| -rw-r--r-- | drivers/vfio/pci/vfio_pci_rdwr.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/vfio/pci/vfio_pci_rdwr.c b/drivers/vfio/pci/vfio_pci_rdwr.c index 5ffd1d9ad4bd..357243d76f10 100644 --- a/drivers/vfio/pci/vfio_pci_rdwr.c +++ b/drivers/vfio/pci/vfio_pci_rdwr.c | |||
| @@ -193,7 +193,10 @@ ssize_t vfio_pci_vga_rw(struct vfio_pci_device *vdev, char __user *buf, | |||
| 193 | if (!vdev->has_vga) | 193 | if (!vdev->has_vga) |
| 194 | return -EINVAL; | 194 | return -EINVAL; |
| 195 | 195 | ||
| 196 | switch (pos) { | 196 | if (pos > 0xbfffful) |
| 197 | return -EINVAL; | ||
| 198 | |||
| 199 | switch ((u32)pos) { | ||
| 197 | case 0xa0000 ... 0xbffff: | 200 | case 0xa0000 ... 0xbffff: |
| 198 | count = min(count, (size_t)(0xc0000 - pos)); | 201 | count = min(count, (size_t)(0xc0000 - pos)); |
| 199 | iomem = ioremap_nocache(0xa0000, 0xbffff - 0xa0000 + 1); | 202 | iomem = ioremap_nocache(0xa0000, 0xbffff - 0xa0000 + 1); |
