summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/vm
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing/selftests/vm')
-rw-r--r--tools/testing/selftests/vm/userfaultfd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c
index 0c0b83953352..b619f672131e 100644
--- a/tools/testing/selftests/vm/userfaultfd.c
+++ b/tools/testing/selftests/vm/userfaultfd.c
@@ -147,7 +147,8 @@ static void *locking_thread(void *arg)
if (sizeof(page_nr) > sizeof(rand_nr)) {
if (random_r(&rand, &rand_nr))
fprintf(stderr, "random_r 2 error\n"), exit(1);
- page_nr |= ((unsigned long) rand_nr) << 32;
+ page_nr |= (((unsigned long) rand_nr) << 16) <<
+ 16;
}
} else
page_nr += 1;
@@ -290,7 +291,8 @@ static void *uffd_poll_thread(void *arg)
msg.event), exit(1);
if (msg.arg.pagefault.flags & UFFD_PAGEFAULT_FLAG_WRITE)
fprintf(stderr, "unexpected write fault\n"), exit(1);
- offset = (char *)msg.arg.pagefault.address - area_dst;
+ offset = (char *)(unsigned long)msg.arg.pagefault.address -
+ area_dst;
offset &= ~(page_size-1);
if (copy_page(offset))
userfaults++;
@@ -327,7 +329,8 @@ static void *uffd_read_thread(void *arg)
if (bounces & BOUNCE_VERIFY &&
msg.arg.pagefault.flags & UFFD_PAGEFAULT_FLAG_WRITE)
fprintf(stderr, "unexpected write fault\n"), exit(1);
- offset = (char *)msg.arg.pagefault.address - area_dst;
+ offset = (char *)(unsigned long)msg.arg.pagefault.address -
+ area_dst;
offset &= ~(page_size-1);
if (copy_page(offset))
(*this_cpu_userfaults)++;