Patch "locking/ww_mutex/test: Use swap() macro" has been added to the 6.13-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    locking/ww_mutex/test: Use swap() macro

to the 6.13-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     locking-ww_mutex-test-use-swap-macro.patch
and it can be found in the queue-6.13 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f9cb8b9493c42cd975ae75aef4d854c8420245df
Author: Thorsten Blum <thorsten.blum@xxxxxxxxx>
Date:   Wed Jul 31 15:58:51 2024 +0200

    locking/ww_mutex/test: Use swap() macro
    
    [ Upstream commit 0d3547df6934b8f9600630322799a2a76b4567d8 ]
    
    Fixes the following Coccinelle/coccicheck warning reported by
    swap.cocci:
    
      WARNING opportunity for swap()
    
    Compile-tested only.
    
    [Boqun: Add the report tags from Jiapeng and Abaci Robot [1].]
    
    Reported-by: Abaci Robot <abaci@xxxxxxxxxxxxxxxxx>
    Reported-by: Jiapeng Chong <jiapeng.chong@xxxxxxxxxxxxxxxxx>
    Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=11531
    Link: https://lore.kernel.org/r/20241025081455.55089-1-jiapeng.chong@xxxxxxxxxxxxxxxxx [1]
    Acked-by: Waiman Long <longman@xxxxxxxxxx>
    Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxxx>
    Signed-off-by: Boqun Feng <boqun.feng@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20240731135850.81018-2-thorsten.blum@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/locking/test-ww_mutex.c b/kernel/locking/test-ww_mutex.c
index 5d58b2c0ef98b..bcb1b9fea5880 100644
--- a/kernel/locking/test-ww_mutex.c
+++ b/kernel/locking/test-ww_mutex.c
@@ -404,7 +404,7 @@ static inline u32 prandom_u32_below(u32 ceil)
 static int *get_random_order(int count)
 {
 	int *order;
-	int n, r, tmp;
+	int n, r;
 
 	order = kmalloc_array(count, sizeof(*order), GFP_KERNEL);
 	if (!order)
@@ -415,11 +415,8 @@ static int *get_random_order(int count)
 
 	for (n = count - 1; n > 1; n--) {
 		r = prandom_u32_below(n + 1);
-		if (r != n) {
-			tmp = order[n];
-			order[n] = order[r];
-			order[r] = tmp;
-		}
+		if (r != n)
+			swap(order[n], order[r]);
 	}
 
 	return order;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux