summaryrefslogtreecommitdiff
path: root/tests/i915
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2019-03-14 17:48:09 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2019-03-15 07:45:50 +0000
commit5a7c7575b5bb9542f722ed6ba095b9d62609cd56 (patch)
tree61be8032da1018748da8b963ad2290347e5f701d /tests/i915
parentde53202ae4b5747b86ccda22986dbeb47f65d732 (diff)
i915/gem_tiled_w[bc]: Tighten computation of upper bound
Fix the off-by-one in computing the last page that caused us to try and mmap the page beyond the end of the object. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com>
Diffstat (limited to 'tests/i915')
-rw-r--r--tests/i915/gem_tiled_wb.c4
-rw-r--r--tests/i915/gem_tiled_wc.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/tests/i915/gem_tiled_wb.c b/tests/i915/gem_tiled_wb.c
index 67d54bd3..827c2d9d 100644
--- a/tests/i915/gem_tiled_wb.c
+++ b/tests/i915/gem_tiled_wb.c
@@ -174,8 +174,8 @@ igt_simple_main
len = size;
}
- first_page = offset & ~(PAGE_SIZE-1);
- last_page = (offset + len + PAGE_SIZE) & ~(PAGE_SIZE-1);
+ first_page = offset & -PAGE_SIZE;
+ last_page = (offset + len + PAGE_SIZE - 1) & -PAGE_SIZE;
offset -= first_page;
linear = gem_mmap__cpu(fd, handle, first_page, last_page - first_page, PROT_READ);
diff --git a/tests/i915/gem_tiled_wc.c b/tests/i915/gem_tiled_wc.c
index 21390729..67ebbc94 100644
--- a/tests/i915/gem_tiled_wc.c
+++ b/tests/i915/gem_tiled_wc.c
@@ -149,8 +149,8 @@ igt_simple_main
len = size;
}
- first_page = offset & ~(PAGE_SIZE-1);
- last_page = (offset + len + PAGE_SIZE) & ~(PAGE_SIZE-1);
+ first_page = offset & -PAGE_SIZE;
+ last_page = (offset + len + PAGE_SIZE - 1) & -PAGE_SIZE;
linear = gem_mmap__wc(fd, handle, first_page, last_page - first_page, PROT_READ);