summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorchiminghao <chi.minghao@zte.com.cn>2022-01-14 14:05:48 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2022-01-15 16:30:27 +0200
commit2c769ed7137a75a8297936fb54e6ff1f56d3d0f1 (patch)
tree8c6beaf481c2048746d2f38d8188102ea0135298 /tools
parent4e5aa1f4c2b489bc6f3ab5ca54747b18a847289d (diff)
downloadlinux-2c769ed7137a75a8297936fb54e6ff1f56d3d0f1.tar.bz2
tools/testing/selftests/vm/userfaultfd.c: use swap() to make code cleaner
Fix the following coccicheck REVIEW: tools/testing/selftests/vm/userfaultfd.c:1531:21-22:use swap() to make code cleaner Link: https://lkml.kernel.org/r/20211124031632.35317-1-chi.minghao@zte.com.cn Signed-off-by: chiminghao <chi.minghao@zte.com.cn> Reported-by: Zeal Robot <zealci@zte.com.cn> 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, 2 insertions, 7 deletions
diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c
index 9354a5e0321c..990f7aecf4a3 100644
--- a/tools/testing/selftests/vm/userfaultfd.c
+++ b/tools/testing/selftests/vm/userfaultfd.c
@@ -1417,7 +1417,6 @@ static void userfaultfd_pagemap_test(unsigned int test_pgsize)
static int userfaultfd_stress(void)
{
void *area;
- char *tmp_area;
unsigned long nr;
struct uffdio_register uffdio_register;
struct uffd_stats uffd_stats[nr_cpus];
@@ -1528,13 +1527,9 @@ static int userfaultfd_stress(void)
count_verify[nr], nr);
/* prepare next bounce */
- tmp_area = area_src;
- area_src = area_dst;
- area_dst = tmp_area;
+ swap(area_src, area_dst);
- tmp_area = area_src_alias;
- area_src_alias = area_dst_alias;
- area_dst_alias = tmp_area;
+ swap(area_src_alias, area_dst_alias);
uffd_stats_report(uffd_stats, nr_cpus);
}