Skip to contentSkip to conversation

list_for_each_rcu must die: audit

PATCH New Paul E. McKenney 1 participant 2 messages Apr 24, 2008 – May 15, 2008 Audit

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 list_for_each_rcu must die: audit

All uses of list_for_each_rcu() can be profitably replaced by the easier-to-use list_for_each_entry_rcu(). This patch makes this change for the Audit system, in preparation for removing the list_for_each_rcu() API entirely.

Signed_off_by: Paul E. McKenney <[email protected]>
---

 audit_tree.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
kernel/audit_tree.c +2 -3
diff -urpNa -X dontdiff linux-2.6.25/kernel/audit_tree.c linux-2.6.25-lfer-audit/kernel/audit_tree.c
@@ -172,10 +172,9 @@ static void insert_hash(struct audit_chu
 struct audit_chunk *audit_tree_lookup(const struct inode *inode)
 {
 	struct list_head *list = chunk_hash(inode);
-	struct list_head *pos;
+	struct audit_chunk *p;
 
-	list_for_each_rcu(pos, list) {
-		struct audit_chunk *p = container_of(pos, struct audit_chunk, hash);
+	list_for_each_entry_rcu(p, list, hash) {
 		if (p->watch.inode == inode) {
 			get_inotify_watch(&p->watch);
 			return p;
#1 lore raw

PATCH 1/1 list_for_each_rcu must die: audit

All uses of list_for_each_rcu() can be profitably replaced by the easier-to-use list_for_each_entry_rcu(). This patch makes this change for the Audit system, in preparation for removing the list_for_each_rcu() API entirely. This time with well-formed SOB.

---

 audit_tree.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
kernel/audit_tree.c +2 -3
diff -urpNa -X dontdiff linux-2.6.25/kernel/audit_tree.c linux-2.6.25-lfer-audit/kernel/audit_tree.c
@@ -172,10 +172,9 @@ static void insert_hash(struct audit_chu
 struct audit_chunk *audit_tree_lookup(const struct inode *inode)
 {
 	struct list_head *list = chunk_hash(inode);
-	struct list_head *pos;
+	struct audit_chunk *p;
 
-	list_for_each_rcu(pos, list) {
-		struct audit_chunk *p = container_of(pos, struct audit_chunk, hash);
+	list_for_each_entry_rcu(p, list, hash) {
 		if (p->watch.inode == inode) {
 			get_inotify_watch(&p->watch);
 			return p;