summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorYan Zhao <yan.y.zhao@intel.com>2020-04-08 09:12:34 +0200
committerAlex Williamson <alex.williamson@redhat.com>2020-04-20 20:40:16 +0200
commit0ea971f8dcd6dee78a9a30ea70227cf305f11ff7 (patch)
treef0f4a20f29d687e32a624bae583175f4444d41a8 /drivers
parentvfio: checking of validity of user vaddr in vfio_dma_rw (diff)
downloadlinux-0ea971f8dcd6dee78a9a30ea70227cf305f11ff7.tar.xz
linux-0ea971f8dcd6dee78a9a30ea70227cf305f11ff7.zip
vfio: avoid possible overflow in vfio_iommu_type1_pin_pages
add parentheses to avoid possible vaddr overflow. Fixes: a54eb55045ae ("vfio iommu type1: Add support for mediated devices") Signed-off-by: Yan Zhao <yan.y.zhao@intel.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/vfio/vfio_iommu_type1.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index aa501e826e70..fbc58284b333 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -555,7 +555,7 @@ static int vfio_iommu_type1_pin_pages(void *iommu_data,
continue;
}
- remote_vaddr = dma->vaddr + iova - dma->iova;
+ remote_vaddr = dma->vaddr + (iova - dma->iova);
ret = vfio_pin_page_external(dma, remote_vaddr, &phys_pfn[i],
do_accounting);
if (ret)