aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert@linux-m68k.org>2015-09-08 17:58:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-08 18:35:28 -0400
commitaf8713b701a74c3784ce6683f64f474a94b1b643 (patch)
tree7ee373a83d59a276797c31ad63876208a624c5ea /tools
parent61e57c0c3a37539e13af03ce68598034d37c7256 (diff)
selftests/userfaultfd: fix compiler warnings on 32-bit
On 32-bit: userfaultfd.c: In function 'locking_thread': userfaultfd.c:152: warning: left shift count >= width of type userfaultfd.c: In function 'uffd_poll_thread': userfaultfd.c:295: warning: cast to pointer from integer of different size userfaultfd.c: In function 'uffd_read_thread': userfaultfd.c:332: warning: cast to pointer from integer of different size Fix the shift warning by splitting the shift in two parts, and the integer/pointer warnigns by adding intermediate casts to "unsigned long". Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'tools')
-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)
147 if (sizeof(page_nr) > sizeof(rand_nr)) { 147 if (sizeof(page_nr) > sizeof(rand_nr)) {
148 if (random_r(&rand, &rand_nr)) 148 if (random_r(&rand, &rand_nr))
149 fprintf(stderr, "random_r 2 error\n"), exit(1); 149 fprintf(stderr, "random_r 2 error\n"), exit(1);
150 page_nr |= ((unsigned long) rand_nr) << 32; 150 page_nr |= (((unsigned long) rand_nr) << 16) <<
151 16;
151 } 152 }
152 } else 153 } else
153 page_nr += 1; 154 page_nr += 1;
@@ -290,7 +291,8 @@ static void *uffd_poll_thread(void *arg)
290 msg.event), exit(1); 291 msg.event), exit(1);
291 if (msg.arg.pagefault.flags & UFFD_PAGEFAULT_FLAG_WRITE) 292 if (msg.arg.pagefault.flags & UFFD_PAGEFAULT_FLAG_WRITE)
292 fprintf(stderr, "unexpected write fault\n"), exit(1); 293 fprintf(stderr, "unexpected write fault\n"), exit(1);
293 offset = (char *)msg.arg.pagefault.address - area_dst; 294 offset = (char *)(unsigned long)msg.arg.pagefault.address -
295 area_dst;
294 offset &= ~(page_size-1); 296 offset &= ~(page_size-1);
295 if (copy_page(offset)) 297 if (copy_page(offset))
296 userfaults++; 298 userfaults++;
@@ -327,7 +329,8 @@ static void *uffd_read_thread(void *arg)
327 if (bounces & BOUNCE_VERIFY && 329 if (bounces & BOUNCE_VERIFY &&
328 msg.arg.pagefault.flags & UFFD_PAGEFAULT_FLAG_WRITE) 330 msg.arg.pagefault.flags & UFFD_PAGEFAULT_FLAG_WRITE)
329 fprintf(stderr, "unexpected write fault\n"), exit(1); 331 fprintf(stderr, "unexpected write fault\n"), exit(1);
330 offset = (char *)msg.arg.pagefault.address - area_dst; 332 offset = (char *)(unsigned long)msg.arg.pagefault.address -
333 area_dst;
331 offset &= ~(page_size-1); 334 offset &= ~(page_size-1);
332 if (copy_page(offset)) 335 if (copy_page(offset))
333 (*this_cpu_userfaults)++; 336 (*this_cpu_userfaults)++;