lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-id: <1386944182-24373-1-git-send-email-andrzej.p@samsung.com>
Date:	Fri, 13 Dec 2013 15:16:22 +0100
From:	Andrzej Pietrasiewicz <andrzej.p@...sung.com>
To:	linux-kernel@...r.kernel.org
Cc:	Andrzej Pietrasiewicz <andrzej.p@...sung.com>,
	Kyungmin Park <kyungmin.park@...sung.com>,
	Marek Szyprowski <m.szyprowski@...sung.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...hat.com>
Subject: [PATCH v3] kernel/locking: mutex: simplify access to the first entry
 in the wait-list

Use list_first_entry instead of explicitly accessing the first entry
with "head".next. The comment one line above becomes obsolete.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@...sung.com>
Reviewed-by: Kyungmin Park <kyungmin.park@...sung.com>
---

v2..v3:

- changed Singed-off-by to Reviewed-by: Kyungmin Park

v1..v2:

- corrected the email address in the second Signed-off-by line

 kernel/locking/mutex.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
index 4dd6e4c..4af4f9c 100644
--- a/kernel/locking/mutex.c
+++ b/kernel/locking/mutex.c
@@ -730,10 +730,9 @@ __mutex_unlock_common_slowpath(atomic_t *lock_count, int nested)
 		atomic_set(&lock->count, 1);
 
 	if (!list_empty(&lock->wait_list)) {
-		/* get the first entry from the wait-list: */
 		struct mutex_waiter *waiter =
-				list_entry(lock->wait_list.next,
-					   struct mutex_waiter, list);
+				list_first_entry(&lock->wait_list,
+						 struct mutex_waiter, list);
 
 		debug_mutex_wake_waiter(lock, waiter);
 
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ