Commit 5a7c7575 authored by Chris Wilson's avatar Chris Wilson

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's avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Antonio Argenziano's avatarAntonio Argenziano <antonio.argenziano@intel.com>
parent de53202a
Pipeline #24184 passed with stages
in 3 minutes and 47 seconds
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment