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: <1446146370-19111-1-git-send-email-bobby.prani@gmail.com>
Date:	Thu, 29 Oct 2015 15:19:29 -0400
From:	Pranith Kumar <bobby.prani@...il.com>
To:	Andrew Morton <akpm@...ux-foundation.org>,
	Rasmus Villemoes <linux@...musvillemoes.dk>,
	Dmitry Vyukov <dvyukov@...gle.com>,
	linux-kernel@...r.kernel.org (open list)
Subject: [PATCH] llist: Use for() initializer and conditional

Simplify the code a bit by using the initializer and conditional
check in for() instead of a separate if() statement in the loop.

Signed-off-by: Pranith Kumar <bobby.prani@...il.com>
---
 lib/llist.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/lib/llist.c b/lib/llist.c
index ae5872b..ddbeebb 100644
--- a/lib/llist.c
+++ b/lib/llist.c
@@ -66,10 +66,7 @@ struct llist_node *llist_del_first(struct llist_head *head)
 {
 	struct llist_node *entry, *old_entry, *next;
 
-	entry = smp_load_acquire(&head->first);
-	for (;;) {
-		if (entry == NULL)
-			return NULL;
+	for (entry = smp_load_acquire(&head->first); entry ; ) {
 		old_entry = entry;
 		next = READ_ONCE(entry->next);
 		entry = cmpxchg(&head->first, old_entry, next);
-- 
2.6.1

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