From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [PATCH] userfaultfd: fix swap.cocci warnings
Date: Tue, 08 Mar 2022 20:59:25 +0800 [thread overview]
Message-ID: <20220308125925.GA46097@c9d76f7cebde> (raw)
In-Reply-To: <202203082010.aZticNAg-lkp@intel.com>
[-- Attachment #1: Type: text/plain, Size: 1484 bytes --]
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Andrea Arcangeli <aarcange@redhat.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>
CC: linux-kernel(a)vger.kernel.org
From: kernel test robot <lkp@intel.com>
mm/userfaultfd.c:743:13-14: WARNING opportunity for swap()
Check for opencoded swap() implementation.
Generated by: scripts/coccinelle/misc/swap.cocci
Fixes: e551a4a9e99d ("userfaultfd: UFFDIO_REMAP uABI")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---
tree: https://git.kernel.org/pub/scm/linux/kernel/git/andrea/aa.git main
head: 597056f5070bec9190a9b6389eb5fcc07ce2cd14
commit: e551a4a9e99d2595c4f1c1ca7b6a62f4b70da1f4 [38/51] userfaultfd: UFFDIO_REMAP uABI
:::::: branch date: 16 hours ago
:::::: commit date: 16 hours ago
Please take the patch only if it's a positive warning. Thanks!
mm/userfaultfd.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
--- a/mm/userfaultfd.c
+++ b/mm/userfaultfd.c
@@ -737,12 +737,10 @@ void double_pt_lock(spinlock_t *ptl1,
{
spinlock_t *ptl_tmp;
- if (ptl1 > ptl2) {
+ if (ptl1 > ptl2)
+
/* exchange ptl1 and ptl2 */
- ptl_tmp = ptl1;
- ptl1 = ptl2;
- ptl2 = ptl_tmp;
- }
+ swap(ptl1, ptl2);
/* lock in virtual address order to avoid lock inversion */
spin_lock(ptl1);
if (ptl1 != ptl2)
prev parent reply other threads:[~2022-03-08 12:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-08 13:05 [andrea-aa:main 38/51] mm/userfaultfd.c:743:13-14: WARNING opportunity for swap() kernel test robot
2022-03-08 12:59 ` kernel test robot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220308125925.GA46097@c9d76f7cebde \
--to=lkp@intel.com \
--cc=kbuild@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.