All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] userfaultfd: fix swap.cocci warnings
  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
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-03-08 12:59 UTC (permalink / raw)
  To: kbuild

[-- 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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [andrea-aa:main 38/51] mm/userfaultfd.c:743:13-14: WARNING opportunity for swap()
@ 2022-03-08 13:05 kernel test robot
  2022-03-08 12:59 ` [PATCH] userfaultfd: fix swap.cocci warnings kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2022-03-08 13:05 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1033 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>

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
config: x86_64-randconfig-c022 (https://download.01.org/0day-ci/archive/20220308/202203082010.aZticNAg-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>


cocci warnings: (new ones prefixed by >>)
>> mm/userfaultfd.c:743:13-14: WARNING opportunity for swap()

Please review and possibly fold the followup patch.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-08 13:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH] userfaultfd: fix swap.cocci warnings kernel test robot

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.