diff options
author | 2022-03-14 19:15:16 -0300 | |
---|---|---|
committer | 2022-03-14 19:15:16 -0300 | |
commit | 65eab2bc7dab326ee892ec5a4c749470b368b51a (patch) | |
tree | 341189a55a3d021db7f1c8a8e5b4772b6c782c25 /drivers/vhost/iotlb.c | |
parent | perf tools: Set build-id using build-id header on new mmap records (diff) | |
parent | Linux 5.17-rc8 (diff) | |
download | linux-dev-65eab2bc7dab326ee892ec5a4c749470b368b51a.tar.xz linux-dev-65eab2bc7dab326ee892ec5a4c749470b368b51a.zip |
Merge remote-tracking branch 'torvalds/master' into perf/core
To pick up fixes that went thru perf/urgent.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'drivers/vhost/iotlb.c')
-rw-r--r-- | drivers/vhost/iotlb.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/vhost/iotlb.c b/drivers/vhost/iotlb.c index 670d56c879e5..40b098320b2a 100644 --- a/drivers/vhost/iotlb.c +++ b/drivers/vhost/iotlb.c @@ -57,6 +57,17 @@ int vhost_iotlb_add_range_ctx(struct vhost_iotlb *iotlb, if (last < start) return -EFAULT; + /* If the range being mapped is [0, ULONG_MAX], split it into two entries + * otherwise its size would overflow u64. + */ + if (start == 0 && last == ULONG_MAX) { + u64 mid = last / 2; + + vhost_iotlb_add_range_ctx(iotlb, start, mid, addr, perm, opaque); + addr += mid + 1; + start = mid + 1; + } + if (iotlb->limit && iotlb->nmaps == iotlb->limit && iotlb->flags & VHOST_IOTLB_FLAG_RETIRE) { |