audit: Use list_move instead of list_del/list_add
Subsystems (2)
PATCH 1/1 audit: Use list_move instead of list_del/list_add
Using list_move() instead of list_del() + list_add().
Reported-by Hulk Robot <[email protected]>
Signed-off-by Baokun Li <[email protected]>
--- kernel/audit_tree.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
kernel/audit_tree.c +4 -8
@@ -689,8 +689,7 @@ void audit_trim_trees(void) tree = container_of(cursor.next, struct audit_tree, list);get_tree (tree); -list_del (&cursor); -list_add (&cursor, &tree->list); +list_move (&cursor, &tree->list);mutex_unlock (&audit_filter_mutex); err =kern_path (tree->pathname,0 , &path);
@@ -899,8 +898,7 @@ int audit_tag_tree(char *old, char *new) tree = container_of(cursor.next, struct audit_tree, list);get_tree (tree); -list_del (&cursor); -list_add (&cursor, &tree->list); +list_move (&cursor, &tree->list);mutex_unlock (&audit_filter_mutex); err =kern_path (tree->pathname,0 , &path2);
@@ -925,8 +923,7 @@ int audit_tag_tree(char *old, char *new)mutex_lock (&audit_filter_mutex);spin_lock (&hash_lock);if (!tree->goner) { -list_del (&tree->list); -list_add (&tree->list, &tree_list); +list_move (&tree->list, &tree_list); }spin_unlock (&hash_lock);put_tree (tree);
@@ -937,8 +934,7 @@ int audit_tag_tree(char *old, char *new) tree = container_of(barrier.prev, struct audit_tree, list);get_tree (tree); -list_del (&tree->list); -list_add (&tree->list, &barrier); +list_move (&tree->list, &barrier);mutex_unlock (&audit_filter_mutex);if (!failed) {
Quoted 1 line · Baokun Li
Using
list_move()instead oflist_del()+list_add().
This should be slightly more efficient since there is no need to poison the pointers.
Quoted 2 lines
Reported-by Hulk Robot <[email protected]>Signed-off-by Baokun Li <[email protected]>
Quoted 51 lines
--- kernel/audit_tree.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)kernel/audit_tree.c +4
-9@@ -689,8 +689,7 @@ void audit_trim_trees(void) tree = container_of(cursor.next, struct audit_tree, list);get_tree (tree); -list_del (&cursor); -list_add (&cursor, &tree->list); +list_move (&cursor, &tree->list);mutex_unlock (&audit_filter_mutex); err =kern_path (tree->pathname,0 , &path);@@ -899,8 +898,7 @@ int audit_tag_tree(char *old, char *new) tree = container_of(cursor.next, struct audit_tree, list);get_tree (tree); -list_del (&cursor); -list_add (&cursor, &tree->list); +list_move (&cursor, &tree->list);mutex_unlock (&audit_filter_mutex); err =kern_path (tree->pathname,0 , &path2);@@ -925,8 +923,7 @@ int audit_tag_tree(char *old, char *new)mutex_lock (&audit_filter_mutex);spin_lock (&hash_lock);if (!tree->goner) { -list_del (&tree->list); -list_add (&tree->list, &tree_list); +list_move (&tree->list, &tree_list); }spin_unlock (&hash_lock);put_tree (tree);@@ -937,8 +934,7 @@ int audit_tag_tree(char *old, char *new) tree = container_of(barrier.prev, struct audit_tree, list);get_tree (tree); -list_del (&tree->list); -list_add (&tree->list, &barrier); +list_move (&tree->list, &barrier);mutex_unlock (&audit_filter_mutex);if (!failed) { --
Quoted 3 lines
Linux-audit mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-audit
- RGB
--
Richard Guy Briggs <[email protected]>
Sr. S/W Engineer, Kernel Security, Base Operating Systems Remote, Ottawa, Red Hat Canada
IRC: rgb, SunRaycer
Voice: +1.647.777.2635, Internal: (81) 32635
Quoted 8 lines · Baokun Li
Using
list_move()instead oflist_del()+list_add().Reported-by Hulk Robot <[email protected]>Signed-off-by Baokun Li <[email protected]>--- kernel/audit_tree.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
Merged into audit/next, thank you.
Signature · 2 lines
paul moore www.paul-moore.com