]> git.baikalelectronics.ru Git - kernel.git/commit
userfaultfd/selftests: use swap() instead of open coding it
authorGuo Zhengkui <guozhengkui@vivo.com>
Fri, 13 May 2022 03:22:56 +0000 (20:22 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 13 May 2022 14:20:12 +0000 (07:20 -0700)
commit09ffa470ea70166b5086b1677263e6c054c31693
tree9665d5feb739bace1c05773eea1dbee9e5380723
parenta4a6f95b5f2e7ce6a4611c998e8527fbc2863f9a
userfaultfd/selftests: use swap() instead of open coding it

Address the following coccicheck warning:

tools/testing/selftests/vm/userfaultfd.c:1536:21-22: WARNING opportunity
for swap().
tools/testing/selftests/vm/userfaultfd.c:1540:33-34: WARNING opportunity
for swap().

by using swap() for the swapping of variable values and drop
`tmp_area` that is not needed any more.

`swap()` macro in userfaultfd.c is introduced in commit c0994419da0a3
("selftests: vm: remove dependecy from internal kernel macros")

It has been tested with gcc (Debian 8.3.0-6) 8.3.0.

Link: https://lkml.kernel.org/r/20220407123141.4998-1-guozhengkui@vivo.com
Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/vm/userfaultfd.c