From 475e6fa3d340e75a454ea09191a29e52e2ee6e71 Mon Sep 17 00:00:00 2001 From: Tetsuo Handa Date: Thu, 24 Jun 2010 11:28:14 +0900 Subject: TOMOYO: Change list iterator. Change list_for_each_cookie to (1) start from current position rather than next position (2) remove temporary cursor (3) check that srcu_read_lock() is held Signed-off-by: Tetsuo Handa Signed-off-by: James Morris --- security/tomoyo/common.h | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'security/tomoyo/common.h') diff --git a/security/tomoyo/common.h b/security/tomoyo/common.h index 1277724edae4..cdc9ef56fd86 100644 --- a/security/tomoyo/common.h +++ b/security/tomoyo/common.h @@ -1023,19 +1023,11 @@ static inline bool tomoyo_same_number_union /** * list_for_each_cookie - iterate over a list with cookie. * @pos: the &struct list_head to use as a loop cursor. - * @cookie: the &struct list_head to use as a cookie. * @head: the head for your list. - * - * Same with list_for_each_rcu() except that this primitive uses @cookie - * so that we can continue iteration. - * @cookie must be NULL when iteration starts, and @cookie will become - * NULL when iteration finishes. */ -#define list_for_each_cookie(pos, cookie, head) \ - for (({ if (!cookie) \ - cookie = head; }), \ - pos = rcu_dereference((cookie)->next); \ - prefetch(pos->next), pos != (head) || ((cookie) = NULL); \ - (cookie) = pos, pos = rcu_dereference(pos->next)) +#define list_for_each_cookie(pos, head) \ + if (!pos) \ + pos = srcu_dereference((head)->next, &tomoyo_ss); \ + for ( ; pos != (head); pos = srcu_dereference(pos->next, &tomoyo_ss)) #endif /* !defined(_SECURITY_TOMOYO_COMMON_H) */ -- cgit v1.2.3