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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080312081201.GA278@tv-sign.ru>
Date:	Wed, 12 Mar 2008 11:12:01 +0300
From:	Oleg Nesterov <oleg@...sign.ru>
To:	Andrew Morton <akpm@...ux-foundation.org>,
	Christoph Hellwig <hch@....de>,
	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Q: (stupid) can't we "fix" hlist_for_each_entry() ?

hlist_for_each_entry/hlist_for_each_entry_rcu doesn't actually need 4
arguments, it could be

#define hlist_for_each_entry_rcu(pos, head, member)		 			\
	for (pos = hlist_entry((head)->first, typeof(*(pos)), member);			\
	     rcu_dereference(pos) != hlist_entry(NULL, typeof(*(pos)), member) &&	\
		({ prefetch((pos)->member.next); 1; });					\
	     (pos) = hlist_entry((pos)->member.next, typeof(*(pos)), member))

Or,

#define hlist_for_each_entry_rcu(pos, head, member)		 			\
	for (pos = (void*)(head)->first;						\
	     rcu_dereference(pos) && ({ prefetch(((hlist_node*)pos)->next); 1; }) &&	\
		({ (pos) = hlist_entry((void*)(pos), typeof(*(pos)), member)); 1; });	\
	     (pos) = (void*)(pos)->member.next)

Q: is it worth "fixing" ?

If yes, what is the "right" way to do this? These macros are spread all over
the kernel...

Oleg.

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