summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/iommufd/iova_bitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iommu/iommufd/iova_bitmap.c')
-rw-r--r--drivers/iommu/iommufd/iova_bitmap.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/iommu/iommufd/iova_bitmap.c b/drivers/iommu/iommufd/iova_bitmap.c
index b94636b7977e..be97bb464f6b 100644
--- a/drivers/iommu/iommufd/iova_bitmap.c
+++ b/drivers/iommu/iommufd/iova_bitmap.c
@@ -465,18 +465,18 @@ void iova_bitmap_set(struct iova_bitmap *bitmap,
last_bit - cur_bit + 1);
void *kaddr;
- if (unlikely(page_idx > last_page_idx))
+ if (unlikely(page_idx > last_page_idx)) {
+ unsigned long left =
+ ((last_bit - cur_bit + 1) << mapped->pgshift);
+
+ bitmap->set_ahead_length = left;
break;
+ }
kaddr = kmap_local_page(mapped->pages[page_idx]);
bitmap_set(kaddr, offset, nbits);
kunmap_local(kaddr);
cur_bit += nbits;
} while (cur_bit <= last_bit);
-
- if (unlikely(cur_bit <= last_bit)) {
- bitmap->set_ahead_length =
- ((last_bit - cur_bit + 1) << bitmap->mapped.pgshift);
- }
}
EXPORT_SYMBOL_NS_GPL(iova_bitmap_set, IOMMUFD);