Skip to content

Commit

Permalink
vfio: avoid possible overflow in vfio_iommu_type1_pin_pages
Browse files Browse the repository at this point in the history
add parentheses to avoid possible vaddr overflow.

Fixes: a54eb55 ("vfio iommu type1: Add support for mediated devices")
Signed-off-by: Yan Zhao <[email protected]>
Signed-off-by: Alex Williamson <[email protected]>
  • Loading branch information
yanzhao56 authored and awilliam committed Apr 20, 2020
1 parent 205323b commit 0ea971f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/vfio/vfio_iommu_type1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0ea971f

Please sign in to comment.