summaryrefslogtreecommitdiff
path: root/drivers/vfio
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@redhat.com>2020-06-02 13:53:00 -0600
committerAlex Williamson <alex.williamson@redhat.com>2020-06-02 13:53:00 -0600
commit4f085ca2f5a8047845ab2d6bbe97089daed28655 (patch)
treeedcdc9a877c289bec1fdde6c26bcaca4f813f138 /drivers/vfio
parentea20868c7197827f2585a65800b9de7d2b2c4bee (diff)
parentc8e9df4744a3e4d897a6ac6e71a38aa8d7b65aa0 (diff)
Merge branch 'v5.8/vfio/kirti-migration-fixes' into v5.8/vfio/next
Diffstat (limited to 'drivers/vfio')
-rw-r--r--drivers/vfio/vfio_iommu_type1.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index a6d632d44c82..391fafe82c5c 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -227,11 +227,12 @@ static void vfio_dma_bitmap_free(struct vfio_dma *dma)
static void vfio_dma_populate_bitmap(struct vfio_dma *dma, size_t pgsize)
{
struct rb_node *p;
+ unsigned long pgshift = __ffs(pgsize);
for (p = rb_first(&dma->pfn_list); p; p = rb_next(p)) {
struct vfio_pfn *vpfn = rb_entry(p, struct vfio_pfn, node);
- bitmap_set(dma->bitmap, (vpfn->iova - dma->iova) / pgsize, 1);
+ bitmap_set(dma->bitmap, (vpfn->iova - dma->iova) >> pgshift, 1);
}
}
@@ -997,14 +998,14 @@ static int update_user_bitmap(u64 __user *bitmap, struct vfio_iommu *iommu,
nbits + shift);
if (copy_from_user(&leftover,
- (const void *)(bitmap + copy_offset),
+ (void __user *)(bitmap + copy_offset),
sizeof(leftover)))
return -EFAULT;
bitmap_or(dma->bitmap, dma->bitmap, &leftover, shift);
}
- if (copy_to_user((void *)(bitmap + copy_offset), dma->bitmap,
+ if (copy_to_user((void __user *)(bitmap + copy_offset), dma->bitmap,
DIRTY_BITMAP_BYTES(nbits + shift)))
return -EFAULT;