Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1469438pxb; Thu, 28 Oct 2021 04:27:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrK4ssQGwWfgxrokI8TEreNuzTrYP6jFlplP1/5814I+7ZZ2eMjAsJulFWYgwTBwBzjlQi X-Received: by 2002:a17:907:3f18:: with SMTP id hq24mr4591406ejc.151.1635420465093; Thu, 28 Oct 2021 04:27:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635420465; cv=none; d=google.com; s=arc-20160816; b=YyS5bnDkifgM2MJTcUgA+gHsPX5FTW7b6DQp4MXRbmwVNd+JHUkY/H0ZcNJV7KVuHL /n7V7/Ym65on0XTA+c6aAoVTx4E+A7RKqzF6KRGLjYJZ3onSF1I+gqsyvlpf4VMCtqLp XDmWChAhigtXNXCQ3f/6S1sZJ9Xz2YSp6cNPRRW4m1+puunCqezkDbgCr7Bh0kBy13dp r5YsJlcF75w2Kyl63TCzPlQZGBiVvEhppWzCgllHP/VbHqG1ttC6U4AhjkbYd84rI3HM 8h/gtosoBCoOi7kNNXlXEkwJODhec10Y3ffMEmESYmv6+Et+q0jHC4HXLRN+BkpZPIY3 mVhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=TvnootBtDGVgLyDMhxKtt7j81OcPK/yRLbkFlYIzag8=; b=WqCRsDOfLMQ/aPbFOSDm6wB37Ko6E57fs4Q35B4VpI3swsv4z0WFz7faOgB8Lxkgzg tnL5teq4mVwedLag4edLM+TlpyIfdLlmZj/iaDlpUr8BfOnMZYC3aeCtv7cBgr5NC9Eq 3atCzPxbCJVVkD8LJWPfibtOtdRenEFqGEGR/W2sx3yda0S2r1K3VswQFOXmCD3YPZOX 3zE/jBpPtiVLAAc+wZpLmv8TS4aG5Wwywh0Im02CarPSGZHC7u2iCSw00sIHfTLE+xXZ HMmM9O+zLKbhzUtI0Oeel+mhFN8c6b8bYbjcIaNjpWBWdq98Zv3KLF7FN4VuDlxtcWBc U/VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=E+fFVcTV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nd29si4905202ejc.75.2021.10.28.04.27.21; Thu, 28 Oct 2021 04:27:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=E+fFVcTV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230169AbhJ1L0F (ORCPT + 99 others); Thu, 28 Oct 2021 07:26:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229578AbhJ1L0E (ORCPT ); Thu, 28 Oct 2021 07:26:04 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3EF6C061570; Thu, 28 Oct 2021 04:23:37 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id oa4so4445883pjb.2; Thu, 28 Oct 2021 04:23:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TvnootBtDGVgLyDMhxKtt7j81OcPK/yRLbkFlYIzag8=; b=E+fFVcTV7AN2DNE8DwXVmv1OniOy3ZL4cwkZIK6QM03yC6+AcEA+AOSVx0kfHyY48c pKRShfobTaldoT1EzJaGCAkXh2rlwcV3xBb3VaOByoK0MKAXkfxiTdeACsvVo8kDa+PN VKWVkdg06o0vpSxt9t/Mtr8k/4i2fQz2zXRxOGVC2Fse7J1zPUnQVFaWnQ9pyXgmRYxQ 2qAuVRGfO9Sx5qsSL7wyOhOEE4D2i3YdnQE2xRw+TnwXGyekz5cvjZ3nplhArQfCud9B bdw1QwyWv1AhpGu27RPrj7llu8qI16NZJy2iRw3pfmpjxLDrWN6W8o5mrL58esrRop3l b5uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TvnootBtDGVgLyDMhxKtt7j81OcPK/yRLbkFlYIzag8=; b=xV9wgLiD2EUTiCYrPXa9R1gpElYN1TB3WtcO4YyJJZyhOZ3hGcUXyRe25MfsLsDoho 5s9SOqBjSYsTWUk8WspM9Zd+gS+ntrRguoeVAT2o5Iz0Nfj2l2rgwsAXifQ24Tkx8oEY 4TJTgXeJWxUg+4fz3rQfbFxyi5bqtAlbgkngN9ZkahmZxvTZ/E9G7wwCDqyhj2KDv4o2 1v9zD4Ipi4/8z5IsuYaz1hG+pQWT2qIPYbqp+F122ouK4ppTOPhs73IAzmwW7HqugiFY J82xWrhZQiksxHZuU7Wv8CsVHlr1AgEtKt9V2lFsS3+EvliGf9gg4vNtyqvpypAp2Uei Zegg== X-Gm-Message-State: AOAM530dEnIx/gr29RRZLsqP2Tjc9psn+VnxzwA/NwYDUYvlHGw+LCvM 2uKyWWYVFb4umS5Ta0OslUIjeYFmfk8= X-Received: by 2002:a17:902:6b4a:b0:13f:8e99:2149 with SMTP id g10-20020a1709026b4a00b0013f8e992149mr3340883plt.87.1635420217299; Thu, 28 Oct 2021 04:23:37 -0700 (PDT) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id x26sm3142758pff.25.2021.10.28.04.23.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 04:23:37 -0700 (PDT) From: cgel.zte@gmail.com X-Google-Original-From: deng.changcheng@zte.com.cn To: akpm@linux-foundation.org Cc: shuah@kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Changcheng Deng , Zeal Robot Subject: [PATCH] userfaultfd/selftests: use swap() to make code cleaner Date: Thu, 28 Oct 2021 11:23:31 +0000 Message-Id: <20211028112331.16152-1-deng.changcheng@zte.com.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Changcheng Deng Use swap() in order to make code cleaner. Issue found by coccinelle. Reported-by: Zeal Robot Signed-off-by: Changcheng Deng --- tools/testing/selftests/vm/userfaultfd.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c index 8a09057d2f22..41dfe6f4ebfb 100644 --- a/tools/testing/selftests/vm/userfaultfd.c +++ b/tools/testing/selftests/vm/userfaultfd.c @@ -1413,7 +1413,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]; @@ -1524,13 +1523,8 @@ static int userfaultfd_stress(void) count_verify[nr], nr); /* prepare next bounce */ - tmp_area = area_src; - area_src = area_dst; - area_dst = tmp_area; - - tmp_area = area_src_alias; - area_src_alias = area_dst_alias; - area_dst_alias = tmp_area; + swap(area_src, area_dst); + swap(area_src_alias, area_dst_alias); uffd_stats_report(uffd_stats, nr_cpus); } -- 2.25.1