diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2019-03-14 17:48:09 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2019-03-15 07:45:50 +0000 |
commit | 5a7c7575b5bb9542f722ed6ba095b9d62609cd56 (patch) | |
tree | 61be8032da1018748da8b963ad2290347e5f701d /tests/i915/gem_tiled_wc.c | |
parent | de53202ae4b5747b86ccda22986dbeb47f65d732 (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/gem_tiled_wc.c')
-rw-r--r-- | tests/i915/gem_tiled_wc.c | 4 |
1 files changed, 2 insertions, 2 deletions
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); |