Skip to content

Commit 07d2505

Browse files
shuahkhtorvalds
authored andcommitted
kselftest/vm: revert "tools/testing/selftests/vm/userfaultfd.c: use swap() to make code cleaner"
With this change, userfaultfd fails to build with undefined reference swap() error: userfaultfd.c: In function `userfaultfd_stress': userfaultfd.c:1530:17: warning: implicit declaration of function `swap'; did you mean `swab'? [-Wimplicit-function-declaration] 1530 | swap(area_src, area_dst); | ^~~~ | swab /usr/bin/ld: /tmp/ccDGOAdV.o: in function `userfaultfd_stress': userfaultfd.c:(.text+0x549e): undefined reference to `swap' /usr/bin/ld: userfaultfd.c:(.text+0x54bc): undefined reference to `swap' collect2: error: ld returned 1 exit status Revert the commit to fix the problem. Link: https://lkml.kernel.org/r/[email protected] Fixes: 2c769ed ("tools/testing/selftests/vm/userfaultfd.c: use swap() to make code cleaner") Signed-off-by: Shuah Khan <[email protected]> Cc: Shuah Khan <[email protected]> Cc: Minghao Chi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 6a0fb70 commit 07d2505

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tools/testing/selftests/vm/userfaultfd.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,7 @@ static void userfaultfd_pagemap_test(unsigned int test_pgsize)
14171417
static int userfaultfd_stress(void)
14181418
{
14191419
void *area;
1420+
char *tmp_area;
14201421
unsigned long nr;
14211422
struct uffdio_register uffdio_register;
14221423
struct uffd_stats uffd_stats[nr_cpus];
@@ -1527,9 +1528,13 @@ static int userfaultfd_stress(void)
15271528
count_verify[nr], nr);
15281529

15291530
/* prepare next bounce */
1530-
swap(area_src, area_dst);
1531+
tmp_area = area_src;
1532+
area_src = area_dst;
1533+
area_dst = tmp_area;
15311534

1532-
swap(area_src_alias, area_dst_alias);
1535+
tmp_area = area_src_alias;
1536+
area_src_alias = area_dst_alias;
1537+
area_dst_alias = tmp_area;
15331538

15341539
uffd_stats_report(uffd_stats, nr_cpus);
15351540
}

0 commit comments

Comments
 (0)